ASP.Net Membership Provider Sample Web.Config

If you would like a version in plain text format, to copy and work with then feel free to use this syntaxHighlighter version.

Also make sure you read Jon Galloway's 10 Things ASP.NET Developers Should Know About Web.config Inheritance and Overrides.

 1NoOutline<?xml version="1.0" encoding="UTF-8"?>
 2NoOutline<configuration>
 3NoOutline <connectionStrings>
 4NoOutline    <remove name="LocalSqlServer" />
 5NoOutline    <!--You add your connectionstring here-->
 6NoOutline    <!--Use something like this for a database in App_data folder-->
 7NoOutline    <add name="LocalSqlServer"
 connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
 8NoOutlineAttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
 providerName="System.Data.SqlClient"/>
 9NoOutline     <!--Use something like this for a Local sql server
10NoOutline     <add name="LocalSqlServer" connectionString="server=machinename\SQLEXPRESS; 
11NoOutlineinitial catalog=databasename;uid=username;Pwd=password" 
providerName="System.Data.SqlClient"/> -->
12NoOutline<!--For more info on connectionStrings take a look at http://www.connectionstrings.com -->
13NoOutline</connectionStrings>
14NoOutline     <system.web>
15NoOutline<!--set if you are using roles-->
16NoOutline     <roleManager>
17NoOutline            <providers>
18NoOutline                <add name="AspNetSqlRoleProvider"
19NoOutline                connectionStringName="LocalSqlServer"
20NoOutline                applicationName="/" 
21NoOutline                type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0,
22NoOutline Culture=neutral,
23NoOutline PublicKeyToken=b03f5f7f11d50a3a"/>
24NoOutline            </providers>
25NoOutline        </roleManager>
26NoOutline     <authentication mode="Forms">
27NoOutline        <forms timeout="50000000"/>
28NoOutline        <!--More info at http://weblogs.asp.net/scottgu/archive/2005/11/08/430011.aspx  -->
29NoOutline      </authentication>
30NoOutline<!--set if you are using membership-->
31NoOutline<!-- You should ALWAYS customize the Membership provider and specify an applicationName...
See
32NoOutlinehttp://weblogs.asp.net/scottgu/archive/2006/04/22/Always-set-the-_2200_applicationName_2200_
33NoOutline-property-when-configuring-ASP.NET-2.0-Membership-and-other-Providers.aspx 
34NoOutlinefor more details... -->
35NoOutline <membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="15">
36NoOutline            <providers>
37NoOutline                <clear/>
38NoOutline                <add name="AspNetSqlMembershipProvider"
39NoOutline                    type="System.Web.Security.SqlMembershipProvider, 
System.Web, Version=2.0.0.0,40NoOutline Culture=neutral,
41NoOutline PublicKeyToken=b03f5f7f11d50a3a"
42NoOutline                    connectionStringName="LocalSqlServer"
43NoOutline                    enablePasswordRetrieval="false"
44NoOutline                    enablePasswordReset="true"
45NoOutline                    requiresQuestionAndAnswer="true"
46NoOutline                    applicationName="/"
47NoOutline                    requiresUniqueEmail="false"
48NoOutline                    passwordFormat="Hashed"
49NoOutline                    maxInvalidPasswordAttempts="5"
50NoOutline                    minRequiredPasswordLength="7"
51NoOutline                    minRequiredNonalphanumericCharacters="1"
52NoOutline                    passwordAttemptWindow="10"
53NoOutline                    passwordStrengthRegularExpression="" />
54NoOutline            </providers>
55NoOutline </membership>
56NoOutline</system.web>
57NoOutline</configuration>