In this article you will get to know how to retrieve logged in user password using ASP.Net.
In the Previous articles i explained what is namespace for arraylist, Get Selected RadioButton Value of RadioButtonList using C# and ASP.Net, how to create serial no. column in gridview using asp.net, Add check boxes column in DataGridView for deleting records from database, what is query string and how to use it in asp.net and many more about ASP.Net.
If you’re using the Membership API in asp.net and need to retrieve a user’s password, you can do so by doing this:
MembershipUser currentUser = Membership.GetUser();
string password = currentUser.GetPassword("Security Answer");
It requires you to pass in the user’s security answer as an added check.
To support this feature, you’ll need to have password retrieval enabled in the web.config. You can do this in the <membership> node under <system.web>. It’ll look something like below :
<add connectionStringName="database_con" applicationName="MySqlConnection" minRequiredPasswordLength="4"
minRequiredNonalphanumericCharacters="0" enablePasswordRetrieval="true" enablePasswordReset="true"
requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Clear" name="Sqlprovider"
Hope this Helps.
Note : Hashed passwords cannot be retrieved. The hash is one way while having the password format set to encrypted enables retrieval of passwords. I’ve updated the web.config File to ensure that passwords can be retrieved.