Published on: 12 Mar, 2015

Forget your super account password login completely in DNN?

Tumblr Digg Google Plus

Have you encountered a problem where you completely forgot your super account login details of your DNN site? Well if you do and you still have the access to the ftp of the site, the following simple code trick should be able to help you solve this problem.

Once you access to the site ftp, simply look for the default.aspx.cs file. Then look for the following method, or any method that related to the Page Load event.

protected override void OnLoad(EventArgs e)

At the very end of the closing tag routine of above code, you can inject this code.

//This will check if the current user is not login on the site.
if (!HttpContext.Current.User.Identity.IsAuthenticated)
	//What you need to remember is the Portal ID and User ID
	//By default if you only have 1 site, the portal id value will be 0 and User Id for the host is 1.
	//0 represent the Portal ID and 1 represent the Host user id.
	//GetUserById(int portalId, int userId)
	UserInfo objUser = UserController.GetUserById(0, 1);
	//You can leave the portalName and IP to empty string
	//UserLogin(int portalId, UserInfo user, string portalName, string ip, bool createPersistentCookie)
	UserController.UserLogin(0, objUser, "", "", true);

Note: if the UserInfo or UserController is not defined you can include the following namespace.

using DotNetNuke.Entities.Users;

Once done, simply refresh the DNN site url and you should be automatically login. Once login, you can remove the code you have already entered and dont forget to change your password.


There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.