Bookmark and Share

Tuesday, November 10, 2009

DNN: how to reset the host password

Here is a way to reset the password of the DNN host user, it's usefull if you forget the password or if you need to install a copy of a DNN installation without knowing the host password:

Declare @UserName NVarChar(255)
Declare @NewPassword NVarChar(255)
Declare @PasswordSalt NVarChar(128)
Declare @Application NVarChar(255)

Set @UserName = 'host' -- This default DNN host user
Set @NewPassword = 'newpassword' --New password

Set @Application = (SELECT [ApplicationID] FROM aspnet_Users WHERE UserName=@UserName)
Set @PasswordSalt = (SELECT PasswordSalt FROM aspnet_Membership WHERE UserID IN (SELECT UserID FROM aspnet_Users WHERE UserName=@UserName))

Exec dbo.aspnet_Membership_ResetPassword @Application, @UserName, @NewPassword, 10, 10, @PasswordSalt, -5

Hope it helps,