Creating user and saving password in clear text. - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Creating user and saving password in clear text.

  • Creating user and saving password in clear text.
  • Hi, I'm creating users programatically but I'm encountering a problem. What I would like to do is send a user password back when they provide username and email. I want to send the password back as clear text as this is not a high security system and this is allowable.

    I've read this on msdn

     

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

    Where I can change the password format in the membership when creating a user. However, after supplying the applicationName and connectionstringName relevant to my app, it seems that the password is always stored in an encrypted/hashed format. This membership block is placed in my <system.web> section in my web.config file. The way I know it is not being recognized is in my password recovery page when I query a user: 

    MembershipUser user = Membership.GetUser(userName, false);
     
    try
     
         string password = u.GetPassword();
     
     catch (Exception e)
     
         
     

    And call the GetPassword method, I always get an exception, "Password Retrieval Not Enabled". I'm not sure what I'm missing or doing wrong. Would appreciate any help.