Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 487
Or Betzalel Avatar asked Sep 18 '09 16:09

Or Betzalel


2 Answers

In your web.config you probably have the setting

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

Could this be the problem?

like image 193
spender Avatar answered Oct 04 '22 20:10

spender


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"/>
like image 33
cjuk Avatar answered Oct 04 '22 19:10

cjuk