I have posted another post for resetting the lost passwords through the database. Today I am going to show how to get the password through a C# code.
DotNetNuke is using 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 of it is encrypted.
But if you want 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";
        }

This method is giving the password of logged in user. But you can customize it as your requirement.