To add asp membership DB to your DB
- Go to .net framework version on your windows directory (C:\Windows\Microsoft.NET\Framework64\v4.0.30319)
- Double click on (aspnet_regsql.exe), choose (Configure SQL for application services) and press next, type the server name and select your DB or type new DB name. finish
- Copy the following code and past it in your site web.config file
<configuration>
  <connectionStrings>
    <add name="SqlServices" connectionString="Data Source=localhost;Integrated Security=SSPI;Initial
Catalog=ApplicationManagmentDB;" />
  </connectionStrings>
  <system.web>
    <authentication mode="Forms" >
    </authentication>
    <authorization>
      <deny users="?" />
      <allow roles="Administrators" />
      <deny users="*" />
    </authorization>
    <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
      <providers>
        <add
          name="SqlProvider"
          type="System.Web.Security.SqlMembershipProvider"
          connectionStringName="SqlServices"
          enablePasswordRetrieval="false"
          enablePasswordReset="false"
          requiresQuestionAndAnswer="false"
          passwordFormat="Hashed"
          applicationName="/" />
      </providers>
    </membership>
    <roleManager defaultProvider="SqlProvider"
      enabled="true"
      cacheRolesInCookie="true"
      cookieName=".ASPROLES"
      cookieTimeout="30"
      cookiePath="/"
      cookieRequireSSL="true"
      cookieSlidingExpiration="true"
      cookieProtection="All" >
      <providers>
        <add
          name="SqlProvider"
          type="System.Web.Security.SqlRoleProvider"
          connectionStringName="SqlServices"
          applicationName="/" />
      </providers>
    </roleManager>
  </system.web>
</configuration>
 
 
No comments:
Post a Comment