ASP.NET MEMBERSHIP的XML配置
做了一个MEMBERSHIP的测试,先记下来,以备后用!JAVAEYE网站是不是被人攻击了啊。。怎么打不开。。晕。。我有好多文章都在里面啊。。都没有备份的。。。
<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>
撸码:复制、粘贴,拿起键盘就是“干”!!!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具