1. 配置表单验证
<system.web> <authentication mode="Forms" /> </system.web>
2. 创建数据存储
工具:aspnet_regsql.exe
位置:C:\Windows\Microsoft.NET\Framework64\v4.0.30319 或 C:\Windows\Microsoft.NET\Framework\v4.0.30319
3. 配置连接字符串和成员资格提供程序
<connectionStrings> <add name="MyMembershipConnString" connectionString="data source=(local)\SQLEXPRESS; Integrated Security=SSPI; Initial Catalog=MyDatabase"/> </connectionStrings>
<membership defaultProvider="MyMembershipProvider"> <providers> <add name="MyMembershipProvider" connectionStringName="MyMembershipConnString" applicationName="MyMembership" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed" type="System.Web.Security.SqlMembershipProvider"/> </providers> </membership>
时间: 2024-11-05 11:10:02