Windows Server 2003; DotNetNuke 4.0.3; SQL Server 2005 Express
While working on a brand new installation of DotNetNuke, I decided to do a backup of the DNN database, then attempt to restore the database to be sure I could backup/restore after I deploy the portal, when later there is more data in the database (users, portals, data, etc.). When I did restore, I found that my restore did not contain the ADMIN and HOST passwords. The accounts were there, but the passwords would not work. Did the default passwords come back? No, they did not work either, and neither did blank passwords work. Maybe the passwords did not backup and/or restore? I’m not sure why I couldn’t use the passwords, but I decided I needed to somehow reset them so I could continue working with this DNN installation. I decided to attempt to edit the passwords directly from SQL Server Management Studio Express (SQL Server MSE). These are the steps I used to edit the DNN 4.0.3 DATABASE.MDF file directly using SQL Server MSE.
Before working directly with the DotNetNuke database, you want to be sure no one is accessing the DNN database. Inside IIS, STOP the website(s) where the DotNetNuke application is running. Maybe you might need to stop IIS altogether if you have many DNN portals working with several websites.
The next step, reset/refresh permissions on the DotNetNuke folder, was very important for my installation. I found it necessary to reset/refresh the permissions on the DotNetNuke application folder BEFORE and AFTER making any changes directly to the DNN DATABASE.MDF file using SQL Server MSE. If I did not reset/refresh permissions before and after SQL Server MSE, I would get errors inside SQL Server MSE or errors attempting to browse to the DotNetNuke portal.
Reset/Refresh Permissions - Using Windows Explorer:
Highlight the DotNetNuke folder and (right-click) to select: Sharing & Security > Security [tab] > Advanced [button] > [enable] Replace permission entries on all child objects with entries shown here that apply to child objects > OK [button] > “Do you wish to continue?” Yes [button]
Using SQL Server Management Studio Express (SQL Server MSE):
To change passwords directly inside the DNN DATABASE.MDF file using SQL Server MSE: if you have not already attached to the database: (right-click) the Databases folder to select Attach… > browse to DotNetNuke\App_Data\ DATABASE.MDF file, and click OK to make the connection. When attached: select the DotNetNuke\App_Data\DATABASE.MDF database from the Databases folder, and open the Tables folder. Highlight the (dbo.)aspnet_Membership table, right-click and select Open Table. You should see data within the table.
The top record is typically the HOST user, and the second record is typically the ADMIN record. You can scroll to the right to confirm the email addresses for HOST/ADMIN. To reset the HOST and/or ADMIN passwords, on the record row you wish to modify, first change the PasswordFormat value from 2 to 0. I found that changing PaswordFormat from 2 to 0 deactivates encryption on passwords. Then enter a new password in the Password field. I then clicked the “Save All” icon on the toolbar, but I suspect the record changes happen immediately. Exit SQL Server Management Studio Express.
Using Windows Explorer:
Reset/Refresh the permissions on the DotNetNuke application folder (see above).
Restart IIS, or Start the website(s) that you stopped earlier – the one(s) that lead to your DotNetNuke application.
Using Your Browser:
Access your DotNetNuke portal and you should now be able to login to the ADMIN and/or HOST account using the new password you set above.
Register a temporary, new user on this portal and note the password for this user. Exit your DotNetNuke portal.
* I create a new user (only the third user in my DNN installation, after HOST and ADMIN) so that DNN can take a new, encrypted version of a new password that I KNOW. You need this encrypted password so that we can re-enable encryption on the passwords for HOST and/or ADMIN.
Note: My portal was set to Registration: None, which is why I needed to get back in as ADMIN and enable registration before I could then create a temporary, new user above, a user whose password I'll use below.
Stop IIS, or Stop the website(s) that leads to your DotNetNuke application.
Using Windows Explorer:
Reset/Refresh the permissions on the DotNetNuke application folder/files and subfolders (see above).
Using SQL Server Management Studio Express (SQL Server MSE):
Databases > Tables > highlight the (dbo.)aspnet_Membership table, then right-click and select Open Table. You should see data within the table. To reset the HOST and/or ADMIN passwords, on the record row you wish to modify, first change the PasswordFormat value from 0 to 2. I found that changing PaswordFormat from 0 to 2 reactivates encryption on passwords. Locate the temporary, new user record you created above. Copy the contents of that temp user Password field into the Password field for the HOST and/or ADMIN user records. Exit SQL Server MSE.
Using Windows Explorer:
Reset/Refresh the permissions on the DotNetNuke application folder/files and subfolders (see above).
Restart IIS, or Start the website(s) that you stopped earlier – the one(s) that lead to your DotNetNuke application.
Using Your Browser:
Access your DotNetNuke portal and you should now be able to login to the ADMIN and/or HOST account using the password of the new user you created above. Change your HOST and/or ADMIN passwords to something unique/secure.