Published on: 12 March, 2015

Forget your super account password login completely in DNN?

Posted by andy | 2021 views 1 likes 0 favourites 0 comments
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.
Share your article with us and add your own google adsense account to earn extra money. Plus, you can promote a link back to your site.
Related Articles
Published on: 28 January, 2018
Sometimes when you create your own DNN Modules, you want to get access to Module settings outside of the PortalModuleBase class. By default, by inheriting the PortalModuleBase you can get the module settings easily by using the following code. Let says you have a setting name called HeaderText.
Published on: 22 May, 2016
If you want to use Gmail SMTP in your DNN website, this can be easily done by specifying the correct port 587 in the SMTP settings. Unfortunately, there is no port number field supplied in the SMTP settings form. So in order to include the port number, you just need to add the in the SMTP settings.
Published on: 21 May, 2016
There are two options to setup the skin template into the DNN website, the first option is to globally set all pages using the default skin template and the second option is to set the skin template manually to each page. Usually when you create skin templates in DNN, there are at least 2 skins will be created. One would be the home page skin and the rest is the generic page skin.
Published on: 19 January, 2016
One of the best feature you can use in ASP.Net is Web API. The framework make it so easy to build HTTP services for browsers, mobile devices or other online applications. It is an ideal choice if you want to build a restful applications.
Related Tutorials
Published on: 17 February, 2017
In this tutorial you will learn how to install a DNN theme package. Before you can install the DNN skin package. You will need to log in as a super account user. The way to install the skin is exactly the same to install a module extension.
Published on: 14 May, 2016
Learn how to create your first new skin template in DNN. You will also learn what are required to create the DNN skin template and what is the structure of the template looks like.
Published on: 14 April, 2016
DNN has a built in Localization framework to help you create website with multiple languages support. By default, the common HTML module shipped in DNN installation does support this feature. Unfortunately, not all of the third party modules available would be able to support multiple languages. If they do, usually they only support the languages via resx files.
Published on: 05 February, 2016
In this tutorial you will learn how to create your first DNN module. This will be a basic module that will display Hello World. You will learn also how to get a module setting and save the value into module settings table and display it on the screen.