Feb 3, 2010

How To: Change Hashed Password using asp.net membership provider

If you try to change password using membershipuser's changepassword method, you may get error, which means you are not doing it the right way!

Resolution:
Since you are using Hashing, you can't retrieve password back from database, so you must reset it before assigning new password like as shown here:

MembershipUser mu = Membership.GetUser();
mu.ChangePassword(u.ResetPassword(), "abc123!");

This will successfully change hashed password with the one you provide in the method call as shown above!

No comments:

Post a Comment