views:

1480

answers:

4

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 double it has anything to do with the password strengh because thats whould throw a different execption.

Here is my code:

Membership.CreateUser(username, password);

Can anyone tell me why is this happening?

A: 

See if this post might help.

Darin Dimitrov
+3  A: 

In your web.config you probably have the setting

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

Could this be the problem?

spender
+1  A: 

Take a look here, it might provide some help.

Quintin Robinson
Thanks, Putting nulls did help
Or Betzalel
Cool, glad you got it, there are some nuances with membership.
Quintin Robinson
+2  A: 

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"/>
cjuk