1

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!

1

1 Answer 1

3

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.