Reputation: 2960
How to work with asp.net changepassword control. When I click the change password button it always gives an error:
Invalid password or new password is invalid. The minimum length of new password 7. You want to use non-alphanumeric characters: 1.
I type new password like "Changepassword123", but the error is still occuring.
The codebehind code is:
protected void changep1_ChangedPassword(object sender, EventArgs e)
{
Response.Write(changep1.CurrentPassword);
Response.Write(changep1.NewPassword);
}
Can someone provide the codebehind code to update user password? Thanks!
Upvotes: 1
Views: 2130
Reputation: 6422
Your error says you need at least 1 non alphanumeric character in your new password. You can change this.
In web.config you can update the minRequiredNonalphanumericCharacters setting.
minRequiredNonalphanumericCharacters="0"
See membership provider setting below that set the minRequiredNonalphanumericCharacters attribute to 0
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="ApplicationServices"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
applicationName="/"/>
</providers>
</membership>
Upvotes: 3