Configure ASP.NET role provider

  1. Run “aspnet_regsql.exe” from c:windowsmicrosoft.netframeworkv2.0.50727
  2. Add the Network Service account to your logins for the SQL Server be sure to set the User Mapping for this account to aspnetdb (the default database)
  3. Select in the databse aspnetdb the role “aspnet_membership_Fullaccess; right click and add the Network Service account to this role
  4. Add the following entry to your connectionstrings settings in the web.config:
        <add name="MySqlRoleManagerConnection" connectionString="Data Source=.;Initial Catalog=aspnetdb;Integrated Security=SSPI;" />
        

    Alternatively you could adjust the connectionstring section as shown below:

        <remove name="LocalSqlServer" /><add name="LocalSqlServer" connectionString="Data Source=.;Integrated Security=True;Initial Catalog=aspnetdb" />
        

    This removes the LocalSqlServer (which points to a SQLExpress instance) from the connectionstrings provided by the machine.config.
    There is no need to define the membership provider (step 5) this way.

  5. Add the membership provider settings to your system.web settings (important: connectionStringName points to the name specified in step 4):
    <membership defaultProvider="CustomizedProvider"> <providers>       
        <add name="CustomizedProvider"       
            type="System.Web.Security.SqlMembershipProvider"       
            connectionStringName="MySqlRoleManagerConnection"       
            applicationName="aex_project"       
            minRequiredPasswordLength="5"       
            minRequiredNonalphanumericCharacters="0" /> </providers>       
    </membership>    
  6. In Visual Studio go to the Project menu and choose ASP.NET Configuration. In the configuration tool change the “Authentication type” to “From the internet” (this adjusts your authentication mode in the web.config from “Windows” to “Forms”)

See also http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx

Share

Leave a Reply

Your email address will not be published. Required fields are marked *