<connectionStrings>
<add name="conn" connectionString="server=.\sqlexpress;uid=sa;pwd=123456;database=test"/>
</connectionStrings>
<system.web>
<!-- 开启角色管理 -->
<roleManager enabled="true" />
<!-- membership配置 -->
<membership userIsOnlineTimeWindow="20">
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add connectionStringName="conn" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/"
requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10" passwordStrengthRegularExpression=""
name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<!-- 启用匿名用户-->
<anonymousIdentification
enabled="true"
cookieName=".AnonymousUser"
cookieTimeout="60"
cookiePath="/"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
cookieProtection="Validation"
cookieless="UseCookies"
/>
<!-- 第一个Profile设置,可用中文,推荐英文 -->
<profile automaticSaveEnabled="true" enabled="true" defaultProvider="MembershipTest">
<providers>
<add name="MembershipTest" connectionStringName="conn" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
<properties>
<add name="性别" type="System.String" allowAnonymous="true" />
<add name="生日" type="System.DateTime" allowAnonymous="true" />
<add name="星座" type="System.String" allowAnonymous="true" />
<group name="地址">
<add name="国家" defaultValue="中国" type="System.String" allowAnonymous="true" />
<add name="城市" type="System.String" allowAnonymous="true" />
<add name="邮编" type="System.Int32" allowAnonymous="true" />
</group>
</properties>
</profile>
<!--
通过 <authentication> 节可以配置 ASP.NET 用来
识别进入用户的
安全身份验证模式。
-->
<authentication mode="Forms">
<forms name="myAuthentication" loginUrl="Login.aspx" timeout="60" />
</authentication>
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置
要显示的 html 错误页
以代替错误堆栈跟踪。
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
<add name="conn" connectionString="server=.\sqlexpress;uid=sa;pwd=123456;database=test"/>
</connectionStrings>
<system.web>
<!-- 开启角色管理 -->
<roleManager enabled="true" />
<!-- membership配置 -->
<membership userIsOnlineTimeWindow="20">
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add connectionStringName="conn" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/"
requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10" passwordStrengthRegularExpression=""
name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<!-- 启用匿名用户-->
<anonymousIdentification
enabled="true"
cookieName=".AnonymousUser"
cookieTimeout="60"
cookiePath="/"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
cookieProtection="Validation"
cookieless="UseCookies"
/>
<!-- 第一个Profile设置,可用中文,推荐英文 -->
<profile automaticSaveEnabled="true" enabled="true" defaultProvider="MembershipTest">
<providers>
<add name="MembershipTest" connectionStringName="conn" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
<properties>
<add name="性别" type="System.String" allowAnonymous="true" />
<add name="生日" type="System.DateTime" allowAnonymous="true" />
<add name="星座" type="System.String" allowAnonymous="true" />
<group name="地址">
<add name="国家" defaultValue="中国" type="System.String" allowAnonymous="true" />
<add name="城市" type="System.String" allowAnonymous="true" />
<add name="邮编" type="System.Int32" allowAnonymous="true" />
</group>
</properties>
</profile>
<!--
通过 <authentication> 节可以配置 ASP.NET 用来
识别进入用户的
安全身份验证模式。
-->
<authentication mode="Forms">
<forms name="myAuthentication" loginUrl="Login.aspx" timeout="60" />
</authentication>
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置
要显示的 html 错误页
以代替错误堆栈跟踪。
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
源码文件:/Files/niunan/membership测试.7z