Topic: How to add a Membership Provider to your ASP.Net application
Description: You can use the guidelines below to help you with setting up a Membership Provider within your web application.
1. First make sure you have the aspnet tables for the providers in your database. If not, you can follow the steps in this topic
Setting up aspnet tables in your database.
2. Add the following lines to your web.config.
<configuration>
<connectionStrings>
<add name="MyDb" connectionString="..." />
<!-- Example --> <add name="CCconnectionString"
connectionString="server=XX.XX.XXX.XXX;database=CovertCoder;uid=davelittleton;pwd=MyPassword;"
providerName="System.Data.SqlClient" />
</connectoinStrings>
<system.web>
... authentication & authorization settings ...
<authentication mode="Forms">
<forms name="Login" loginUrl="Login.aspx" timeout="600"/>
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="CCconnectionString"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="CovertCoder"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="8"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""/>
</providers>
</membership>
<anonymousIdentification enabled="true"/>
<profile enabled="true">
<properties>
<add name="FirstName" type="System.String"/>
<add name="LastName" type="System.String" />
<add name="MyTheme" defaultValue="Blue" allowAnonymous="true"/>
</properties>
</profile>
<roleManager enabled="true" defaultProvider="CustomizedRoleProvider">
<providers>
<add name="CustomizedRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="MyDb" />
</providers>
</roleManager>
<siteMap defaultProvider="RoleEnabled_AspNetXmlSiteMapProvider" enabled="true">
<providers>
<clear/>
<add name="RoleEnabled_AspNetXmlSiteMapProvider"
type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
siteMapFile="web.sitemap"
securityTrimmingEnabled="true"/>
</providers>
</siteMap>
</system.web>
</configurations>