Search code examples
c#.netencryptionmembership-provider

How to user ``MembershipProvider``? - Encrypt Password


I have an external application where the Administrator can set the details of the users, so I'm looking for a way to set the password of the users.

What I need for this is the same encryption is using .NET(In the main app I have implemented all these using WebSecurity).

Also I saw I can duplicate the same encryption using Membership Provider but I can't figure out how to implement it, because MembershipProvider.EncryptPassword is a protected method.

Any idea how can I get the same encryption??

Note: Example input output
Password: testtest

Encrypted password: AMIbPCqv2CKPG7xl7wAbxVvWmML1r0J1aMqTXzq5KwN56pTPp5DNdVQVUNvICRVmSQ==


Solution

  • a way to set the password of the users

    Not advisable to do so from security perspective. You should rather have a default password set on user creation and on first login force user to set a new password. This way you do not need to create a password really.

    I might be overlooking your requirement but it seems you are going too far with this.