Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

requiresQuestionAndAnswer set to false in web.config but RequiresQuestionAndAnswer is true at runtime

In an ASP.net web application I have defined the following Membership provider in the web.config:

<membership>
  <providers>
    <add connectionStringName="MyServer" name="MyServer" type="System.Web.Security.SqlMembershipProvider" 
      enablePasswordReset="true" 
      requiresQuestionAndAnswer="false" 
      enablePasswordRetrieval="false" />
  </providers>
</membership>

When I run the application in the debugger, the property Membership.Provider.RequiresQuestionAndAnswer is true.

Why? And how can I fix this?

Update: Ar tuntime, the Membership.Providers collection contains two instances of Provider that are almost identical. The differences are:

  • The first Provider has Name=="AspNetSqlMembershipProvider" and RequiresQuestionAndAnswer==true
  • The second Provider has Name=="MyServer" and RequiresQuestionAndAnswer==false.

Now trying to figure out where the first one is coming from.

like image 960
urig Avatar asked Oct 19 '22 10:10

urig


1 Answers

Per the follow up question, the mystery providers is defined on a lower level config file, named machine.config, which is the server-wide parent config file for all asp.net sites running on the machine. See some more details at the MSDN page for asp.net config hierarchy.

like image 192
Ken Egozi Avatar answered Nov 15 '22 06:11

Ken Egozi