MembershipUser.ResetPassword
requiresQuestionAndAnswer
<membership defaultProvider="MyMembershipProvider"> <providers> <clear/> <add name="MyMembershipProvider" type="System.Web.Security.SqlMembershipProvider" applicationName="/" connectionStringName="MySqlClient" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="false" maxInvalidPasswordAttempts="1000" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" /> <add name="MyMembershipProviderAdmin" type="System.Web.Security.SqlMembershipProvider" applicationName="/" connectionStringName="MySqlClient" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" />
System.Web.Security.MembershipUser user = Membership.Providers["MyMembershipProviderAdmin"].GetUser(userName, false); //If the admin does not supply a password then //the system will reset password to system defined password //and we will change that to the specified password if (currentPassword == "") currentPassword = user.ResetPassword(); bool IsUpdated = user.ChangePassword(currentPassword, password);
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.