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