View Single Post
  #2 (permalink)  
Old March 3rd, 2008, 04:23 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

The ASP.NET Application Services by default use a connection string called LocalSqlServer that looks for an ASPNETDB.mdf file in the App_Data folder. This means that Membership, Roles and Profile all make use of this connection. In your config file, you changed the behavior for Membership like this:

<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="myconn" />

With this change, the Membership provider uses the myconn connection string, but the RoleManager doesn't yet. In order to tell the RoleManager to use myconn as well you need to override its settings as well like this:

<roleManager defaultProvider="SqlProvider"
  .. other attributes go here
>
  <providers>
    <add
      name="SqlProvider"
      type="System.Web.Security.SqlRoleProvider"
      connectionStringName="myconn"
  />
  </providers>
</roleManager>

This changes the RoleManager and sets Sqlprovider as the new default provider. Alternatively, you could remove and readd the standard settings for RoleManager, just like you do with Membership. The machine.config file on your machine (at C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONF IG) defines the default behavior for these providers.

Hope this sheds some light....

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004