Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
im using the built in database in asp.net , i wanted to know the user details and their passwords . i can get the user details but i cannot fetch their passwords , it's in encrypted format. so how do i fetch the password details..
Posted
Comments
Richard MacCutchan 24-Feb-14 7:08am    
You don't. Passwords are encrypted for a reason.
kishorebt 24-Feb-14 7:16am    
if the admin wants to know the password of a particular user then how to access those passwords. if they are encrypted , there must be way to decrypt them ...
Nitij 25-Feb-14 1:14am    
Passwords are generally stored after hashing with a salt which is a one way encryption and it is not feasible to decrypt them.

1 solution

You need to change the "membership" setting in Web.Config in order to able to see the password as text. Anyway it is not a good practice to save password as plain text.

After the change in setting...if you will register a new user, application will save the password as plain text. So to verify the approach, you need to register a new user and check. Following are the changes, we need to make:

1. Comment out existing membership provider:
<!--<membership defaultProvider="DefaultMembershipProvider">
     <providers>
       <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
           </providers>
   </membership>-->

2. Add new provider:
<membership defaultprovider="MyMembershipProvider">
  <providers>
    <clear />
    <add name="MyMembershipProvider"
         type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
         connectionStringName="DefaultConnection"
         maxInvalidPasswordAttempts="5"
         passwordAttemptWindow="10"
         minRequiredNonalphanumericCharacters="0"
         minRequiredPasswordLength="4"
         passwordStrengthRegularExpression=""
         passwordFormat="Clear"
         enablePasswordReset="true"
         enablePasswordRetrieval="false"
         requiresQuestionAndAnswer="false"
         requiresUniqueEmail="true" />
  </providers>
</membership>


You can see here passwordFormat="Clear", so password would not be encrypted any more for incoming user.

The parameter
type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
must be valid....so you can use existing value of type as it was in the commented code as per point 1.

The value of "connectionStringName" must be valid so whatever name you have provided for connection string just use that one.

Hope it would help. Thanks.
 
Share this answer
 
v5
Comments
Snesh Prajapati 24-Feb-14 7:52am    
@Kishore.. Any update ?
kishorebt 24-Feb-14 22:55pm    
im getting content model as empty . ive even replaced the type with the type from the commented segment. though im getting the content model empty. and about the connectionstringname ive to copy that from properties of DB or ive to do some thing else.
Snesh Prajapati 24-Feb-14 23:00pm    
There must be some space left while typing...for any attribute or value....just remove that.
kishorebt 24-Feb-14 23:37pm    
thnks for the support problem solved.
Snesh Prajapati 24-Feb-14 23:38pm    
Most Welcome. Glad to know !!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900