Changing Membership provider

Need to change the membership provider programmatically
 
string username = "user";
string password = "password";
MembershipUser membershipUser = Membership.Providers["SqlMembershipProviderOther"].GetUser(username);
membershipUser.ChangePassword(membershipUser.ResetPassword(), password);
 
Also worth checking out here 

3 thoughts on “Changing Membership provider”

  1. Bryan,

    Is there anyway possible to simply reset the user password without knowing what it currently is? As the administrator a user may forget their password(and security question). Both are encrypted so passing along the credentials to MembershipUser.ResetPassword or ChangePassword() may not be possible. Any suggestions? Thanks!

  2. Using the Microsoft membership provider, the only way would be to recreate a new user and remove the old one.

    What I have done before is extend the Membership provider to allow for this functionality.

  3. Thanks, I have noticed if you set requiresQuestionAndAnswer="false" in your web.config it will let you reset it without knowing the answer to the security question. That seems to be the easiest solution, but lowers the security level a bit. Thanks for the reply!

Leave a Reply

Your email address will not be published. Required fields are marked *