hi Friend i have a problem to create user through Membership provider
I Wrote

try
{
    Membership.CreateUser(txtbox1.Text, txtbox2.Text);
    Response.Redirect("AHome.aspx");
}
catch (Exception ex)
{
    Response.Write(ex.Message);
}

and I got
"The password-answer supplied is invalid. Exception"

Please Help Me......

Recommended Answers

All 2 Replies

I guess you the provider has enable question-answer which require you to provide that information during user creation as well. Go to web.config and disable that feature by setting requiresQuestionAndAnswer="false"

<membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider"
             type="System.Web.Security.SqlMembershipProvider, System.Web,&#xD;&#xA;             Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

             connectionStringName="ApplicationServices"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="false"
             requiresUniqueEmail="true"
             passwordFormat="Hashed"
             minRequiredNonalphanumericCharacters="0"
             minRequiredPasswordLength="3"
             maxInvalidPasswordAttempts="3"
             passwordAttemptWindow="15"/>
      </providers>
    </membership>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.