Search code examples
c#asp.netweb-configmembershipasp.net-4.0

Why "Membership" section doesn't appear in the Web.config?


ASP.NET 4.0 and C#

I'm using the default membership provider with the SqlExpress DB that the ASP.NET had created for me, but I want to modify some settings.

So I went to the web.config file to search for the <Membership> and <default provider> to change the settings there, but I didn't find them!

I don't want to create a new provider. I just want to modify the existing one. Where are the settings?


Solution

  • Because it's the default using default values.

    Below is an example. put it after <system.web>

    <membership>
            <providers>
                <clear/>
                <add name="AspNetSqlMembershipProvider"
                    connectionStringName="LocalSqlServer"
                    enablePasswordRetrieval="false"
                    enablePasswordReset="true"
                    requiresQuestionAndAnswer="true"
                    applicationName="/"
                    requiresUniqueEmail="false"
                    passwordFormat="Hashed"
                    maxInvalidPasswordAttempts="5"
                    minRequiredPasswordLength="7"
                    minRequiredNonalphanumericCharacters="1"
                    passwordAttemptWindow="10"
                    passwordStrengthRegularExpression=""                     
                    type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
            </providers>
        </membership>