自定义membership rolemanager provider

定义membership rolemanager provider

1.  用aspnet_regsql.exe(默认位置C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe)创建所需数据库

2.    修改web.config

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <connectionStrings>
    <add name="yourconnection" connectionString="Data Source=yourdatasource;Initial Catalog=yourcatalog;User ID=yourid;Password=yourpassword"/>
  </connectionStrings>
  <system.web>
    <authentication mode="Forms"/>
    <roleManager enabled="true" defaultProvider="yourrolemanager">
      <providers>
        <add name="yourrolemanager" type="System.Web.Security.SqlRoleProvider" connectionStringName="yourconnection" applicationName="yourapplication"/>
      </providers>
    </roleManager>
    <membership defaultProvider="yourmembership">
      <providers>
        <clear/>     //清楚默认providers
        <add name="yourmembership" type="System.Web.Security.SqlMembershipProvider" connectionStringName="yourconnection" applicationName="yourapplication" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed"/>
      </providers>
</membership>
</system.web>
<configuration>


你可能感兴趣的:(自定义membership rolemanager provider)