How to get user information from ASPNETDB using stored procedures

On my admin page, I'm trying to get UserName, Password and Email of users to re-populate the controls when the administrator clicks on the username from the gridview. It seems I can’t get the password, because I need a parameter (password) that I can’t find.

I am using ASPNETDB database stored procedures.

For Each usr As MembershipUser In Membership.GetAllUsers() Debug.Print(usr.Email) Debug.Print(usr.UserName) Debug.Print(usr.GetPassword("")) 'This line errors out Next 
+4
source share
2 answers

You need to enable the Membership.EnablePasswordRetrieval Property . Here is an example configuration from MSDN:

 <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="20"> <providers> <add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="SqlServices" enablePasswordRetrieval="true" enablePasswordReset="false" requiresQuestionAndAnswer="false" passwordFormat="Encrypted" applicationName="MyApplication" /> </providers> </membership> 

Note that the string enablePasswordRetrieval="true" - this is what you should check out the section membership section system.web Web.config file for your ASP.NET application.

+4
source

The documentation states that you need to pass the answer to the password question in order to get the password.

+1
source

All Articles