locked
How to retreve Password from UserName using asp.net membership Provider RRS feed

  • Question

  • User-455811767 posted

    Hi

    I wanted to retreve password using membership provider.i have written code as follows,but iam getting following error

    Hashed passwords cannot be decoded.

    here is my code

    In Web.Config file

     <add name="AspNetSqlMembershipProvider" 
                 type="System.Web.Security.SqlMembershipProvider" 
                 connectionStringName="Connection" 
                 applicationName="SampleApplication"
                 enablePasswordRetrieval="true"
                 enablePasswordReset="true"
                 requiresQuestionAndAnswer="false"
                 requiresUniqueEmail="false"
                 passwordFormat="Clear"
                 minRequiredPasswordLength="4"
                 minRequiredNonalphanumericCharacters="0"
                 passwordStrengthRegularExpression=""/>

    In Aspx.cs File

                  userName = Membership.GetUserNameByEmail(emailId);
                  password = Membership.Provider.GetPassword(userName, String.Empty);

    Please Help me,how to retreve password,here i don't want to change password and generate new passwords,

    i wanted to retreve actual password.

    Thanks

    Tuesday, April 26, 2011 12:30 AM

Answers

  • User533502567 posted

    I wanted to retreve password using membership provider.i have written code as follows,but iam getting following error

    Hashed passwords cannot be decoded.

    May be you stored that password in hashed format. Try by removing that user pw and add it again. From MSDN..

    Hashed passwords are hashed using a one-way hash algorithm and a randomly generated salt value when stored in the database. When a password is validated, it is hashed with the salt value in the database for verification. Hashed passwords cannot be retrieved.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 26, 2011 9:18 AM
  • User-455811767 posted

     

    Hi Vijay thanks for the post.

    I have gone through the link,it was very useful to me.

    Based on that artical i removed all the existed users and i confidured again my web.config file as below

     <add name="AspNetSqlMembershipProvider"
                 type="System.Web.Security.SqlMembershipProvider"
                 connectionStringName="Connection"
                 applicationName="sampleapplication"
                 enablePasswordRetrieval="true"
                 enablePasswordReset="true"
                 requiresQuestionAndAnswer="false"
                 requiresUniqueEmail="true"
                 passwordFormat="Encrypted"
                 maxInvalidPasswordAttempts="5"
                 minRequiredPasswordLength="4"
                 minRequiredNonalphanumericCharacters="0"
                 passwordAttemptWindow="10"
                 passwordStrengthRegularExpression="^(?=.*\d).{4,8}$"
               />

    Before that i used hashed password Format.that is the reason its not working.

    Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 29, 2011 5:23 AM

All replies

  • User1682618242 posted

    Try with passwordFormat="Encrypted"

    Tuesday, April 26, 2011 3:29 AM
  • User-455811767 posted

    Try with passwordFormat="Encrypted"

    When i used this iam getting follwing Error

    Hashed passwords cannot be decoded.

    Any other solution

    Thanks

    Tuesday, April 26, 2011 3:44 AM
  • User533502567 posted

    I wanted to retreve password using membership provider.i have written code as follows,but iam getting following error

    Hashed passwords cannot be decoded.

    May be you stored that password in hashed format. Try by removing that user pw and add it again. From MSDN..

    Hashed passwords are hashed using a one-way hash algorithm and a randomly generated salt value when stored in the database. When a password is validated, it is hashed with the salt value in the database for verification. Hashed passwords cannot be retrieved.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 26, 2011 9:18 AM
  • User-455811767 posted

     

    Hi Vijay thanks for the post.

    I have gone through the link,it was very useful to me.

    Based on that artical i removed all the existed users and i confidured again my web.config file as below

     <add name="AspNetSqlMembershipProvider"
                 type="System.Web.Security.SqlMembershipProvider"
                 connectionStringName="Connection"
                 applicationName="sampleapplication"
                 enablePasswordRetrieval="true"
                 enablePasswordReset="true"
                 requiresQuestionAndAnswer="false"
                 requiresUniqueEmail="true"
                 passwordFormat="Encrypted"
                 maxInvalidPasswordAttempts="5"
                 minRequiredPasswordLength="4"
                 minRequiredNonalphanumericCharacters="0"
                 passwordAttemptWindow="10"
                 passwordStrengthRegularExpression="^(?=.*\d).{4,8}$"
               />

    Before that i used hashed password Format.that is the reason its not working.

    Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 29, 2011 5:23 AM