views:

186

answers:

2

I'm following this walktrough: http://msdn.microsoft.com/en-us/library/879kf95c.aspx to add user login and register pages using out-of-the-box asp.net login and registration controls. For example, for the user registration I'm using CreateUserWizard.

Now I want to customize the registration process, I want to remove the security questions, and add a "Location" field to be asked.

All articles related to this mention the section "membership" and "profile" in web.config, my problem is they are not there in my web.config. Should I add them manually? Or should they be present (autogenerated).

+1  A: 

You have to register your MembershipProvider 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 registred t in the web.config that is the 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>
Marwan Aouida
+1  A: 

Go ahead and manually enter the information. When Visual Studio generates a web.config file for you "automagically", it is based on the current project settings and any potential dependencies it may have detected. It doesn't contain every single web.config option and it is safe to add new fields as needed.

Dillie-O