Web.config does not contain a membership section

I am following this walkthrough: http://msdn.microsoft.com/en-us/library/879kf95c.aspx add custom login and register pages using asp.net login and registration ready-made elements. For example, I use CreateUserWizard to register a user.

Now I want to customize the registration process, I want to remove the security questions and add the Location field to ask.

All articles related to this mention the "membership" and "profile" section in the web.config, my problem is they are not in my web.config. Do I have to add them manually? Or they must be present (auto-generated).

+1


a source to share


2 answers


You have to register your MemberhipProvider manually in your web.config:

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

      



The connectionString attribute is used to set the name of the connection string registered by t in the web.config file which is for your memeberhsip provider.

<connectionStrings>
        <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
    </connectionStrings>

      

+2


a source


Go ahead and manually enter the information. When Visual Studio creates a web.config file for you "automatically", it is based on the current project settings and any possible dependencies it might find. It doesn't contain all the web.config options and it is safe to add new fields as needed.



+1


a source







All Articles