I have posted another post for resetting lost passwords through the database. Today I am going to show you how to get the password through a C# code.

DotNetNuke uses a highly secured encrypted method to save passwords to the system. I am not going to explain it here. In some other cases you may need to retrieve the saved passwords. It won’t possible to read it via SQL tables because it is encrypted.

If you wish to compare the passwords with your logged in user or with your passing password string you can use this method.

public string ReturnPw()
           UserController uc = new UserController();
           UserInfo ui = new UserInfo();
           if (UserId > 0)
               ui = uc.GetUser(this.PortalId, this.UserId);
               string un = ui.Username.ToString();

               UserInfo oUser = UserController.GetUserByName(this.PortalId, un);
               if (oUser != null)
                   //Get the password string pwrd = UserController.GetPassword(ref oUser, "");
                   return pwrd;
           return "N/A";