• dnn重置Host密码


    方法一:

    要求条件是已知一个账户的账号和密码。可以通过手动方式重置,也可以通过下面的脚本。

     DECLARE @databaseName AS VARCHAR (128);
    
    SELECT @databaseName = DB_NAME();
    
    PRINT 'RESET PASSWORD IN DATABASE : ' + @databaseName;
    
    PRINT '-----------------------------' + REPLICATE('-', DATALENGTH(@databaseName));
    
    DECLARE @knownUserName AS NVARCHAR (128);
    
    DECLARE @lostUserName AS NVARCHAR (128);
    
    DECLARE @lostUserId AS NVARCHAR (128);
    
    DECLARE @knownPassword AS NVARCHAR (128);
    
    DECLARE @knownSalt AS NVARCHAR (128);
    
    --pensl为已知密码的用户名
    SET @knownUserName = 'pensl';
    
    SET @lostUserName = 'host';
    
    SELECT @knownPassword = Password,
           @knownSalt = PasswordSalt
    FROM   aspnet_Membership
           INNER JOIN
           aspnet_users
           ON aspnet_Membership.UserId = aspnet_users.UserId
    WHERE  UserName = @knownUserName;
    
    PRINT '';
    
    PRINT 'Known Password for "' + @knownUserName + '" is : ' + @knownPassword;
    
    PRINT 'Known Password Salt for "' + @knownUserName + '" is : ' + @knownSalt;
    
    SELECT @lostUserId = aspnet_Membership.UserId
    FROM   aspnet_Membership
           INNER JOIN
           aspnet_users
           ON aspnet_Membership.UserId = aspnet_users.UserId
    WHERE  UserName = @lostUserName;
    
    PRINT '';
    
    PRINT 'UserID for "' + @lostUserName + '" is : ' + @lostUserId;
    
    PRINT '';
    
    IF (DATALENGTH(@lostUserName) <= 0
        OR @lostUserName IS NULL)
        PRINT 'Invalid Lost User Name ' + @lostUserName;
    ELSE
        BEGIN
            IF (DATALENGTH(@knownUserName) <= 0
                OR @knownUserName IS NULL)
                PRINT 'Invalid Lost User Name ' + @lostUserName;
            ELSE
                BEGIN
                    IF (DATALENGTH(@knownPassword) <= 0
                        OR @knownPassword IS NULL)
                        PRINT 'Invalid Known Password ' + @knownPassword;
                    ELSE
                        BEGIN
                            IF (DATALENGTH(@knownSalt) <= 0
                                OR @knownSalt IS NULL)
                                PRINT 'Invalid Known Salt ' + @knownSalt;
                            ELSE
                                BEGIN
                                    PRINT '';
                                    PRINT 'BEFORE';
                                    SELECT LEFT(UserName, 12) AS UserName,
                                           aspnet_Membership.UserId,
                                           LEFT(Email, 20) AS Email,
                                           Password,
                                           PasswordSalt
                                    FROM   aspnet_Membership
                                           INNER JOIN
                                           aspnet_users
                                           ON aspnet_Membership.UserId = aspnet_users.UserId
                                    WHERE  UserName IN (@knownUserName, @lostUserName);
                                    PRINT '';
                                    PRINT 'Changing Password for User Id : "' + @lostUserId + '" to "' + @knownPassword + '"';
                                    PRINT '';
                                    UPDATE  aspnet_Membership
                                        SET Password     = @knownPassword,
                                            PasswordSalt = @knownSalt
                                    -- SELECT UserId, Password, PasswordSalt
                                    -- FROM aspnet_Membership
                                    WHERE   UserId = @lostUserId;
                                    PRINT '';
                                    PRINT 'AFTER';
                                    SELECT LEFT(UserName, 12) AS UserName,
                                           aspnet_Membership.UserId,
                                           LEFT(Email, 20) AS Email,
                                           Password,
                                           PasswordSalt
                                    FROM   aspnet_Membership
                                           INNER JOIN
                                           aspnet_users
                                           ON aspnet_Membership.UserId = aspnet_users.UserId
                                    WHERE  UserName IN (@knownUserName, @lostUserName);
                                END
                        END
                END
        END
    
    
    GO
    PRINT '';
    
    PRINT ' * * * END OF SCRIPT * * *';
    
    PRINT '';

    方法二:(更方便)

    注册一个新用户testuser,然后去数据库中的users表找到刚注册的testuser用户,将IsSuperUser字段由false改为True。然后再用testuser账户登录DNN系统,admin->user account中将admin的密码重置就可以了。而host的密码要在host->SuperUser Account中重置。

    转自:http://blog.csdn.net/xw13106209/article/details/5101731

  • 相关阅读:
    c# 查找进程
    第三方打包工具
    WebClient 上传和下载
    .net 读取文件
    winfrom 圆角panel
    窗体或控件的两种拖动方式
    winfrom 获取当前屏幕尺寸
    动态修改配置文件web服务地址
    将字符串编码成 GBK
    .net(C#) 读取配置文件
  • 原文地址:https://www.cnblogs.com/zhangpengshou/p/3070705.html
Copyright © 2020-2023  润新知