Error while creating a Membership user "The password-answer supplied is invalid"

22,525

Solution 1

In your web.config you probably have the setting

<system.web>
    <membership>
        <providers>
            <add bla="bla" requiresQuestionAndAnswer="true" ...

Could this be the problem?

Solution 2

Using @spender's tip (+1) I found the below worked for me by explicitly stating requiresQuestionAndAnswer="false" in the web.config (I had to add the attribute). I then found I could just use Membership.CreateUser(userName, password, email); to create my user.

<system.web>  
<membership>  
    <providers>  
        <add bla="bla" requiresQuestionAndAnswer="false"/>

Solution 3

you need to set parameters in web.config

<system.web>
<membership>
    <providers>
<add name="YOURMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="con"  minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Clear" applicationName="YourAppName" maxInvalidPasswordAttempts="2147483647"/>

I tried this. Its working Fine. Thanks

Share:
22,525
Or Betzalel
Author by

Or Betzalel

I am a beginner programmer in asp.net 3.5.

Updated on May 17, 2020

Comments

  • Or Betzalel
    Or Betzalel about 4 years

    I tried creating a new user using CreateUser method. but when I click create user button I get this weird error : "The password-answer supplied is invalid".

    I already tried putting a strong password (123$567) or a normal password(1234). I doubt it has anything to do with the password strength because that would throw a different exception.

    Here is my code:

    Membership.CreateUser(username, password);
    

    Can anyone tell me why is this happening?