I currently have 2 simple ASP .Net applications. Both applications share the same aspnetdb membership database for membership, roles and providers and the same encryption and decryption keys. They also have seperate websites and seperate application pools in IIS.
The problem I am having is that despite both applications having a role provider with different application names they both are registering and using the role provider from the second application after the second application starts up.
Both applications have the following code block on the default page:
<p>
Current role provider details: <%= Roles.Provider.Name +", "+ Roles.Provider.ApplicationName %>
</p>
Application 1 has the following roleprovider block in its web.config:
<roleManager
enabled="true"
defaultProvider="AspNetSqlRoleProviderWebApp1"
cacheRolesInCookie="true"
domain="Sample Web Application 1"
cookiePath="path1.domain.co.uk"
>
<providers>
<add
connectionStringName="aspnetdbConnection"
applicationName="Sample Web Application 1"
description="AspNetSqlRoleProviderWebApp1"
name="AspNetSqlRoleProviderWebApp1"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
/>
</providers>
</roleManager>
Application 2 has the following similiar role provider statement in its web.config:
<roleManager
enabled="true"
defaultProvider="AspNetSqlRoleProviderWebApp2"
cacheRolesInCookie="true"
domain="Sample Web Application 2"
cookiePath="path2.domain.co.uk"
>
<providers>
<add
connectionStringName="aspnetdbConnection"
applicationName="Sample Web Application 2"
description="AspNetSqlRoleProviderWebApp2"
name="AspNetSqlRoleProviderWebApp2"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
/>
</providers>
</roleManager>
The problem I am having is that when I display sample application 1 I get
Current role provider details: AspNetSqlRoleProviderWebApp1, Sample Web Application 2
And when I view sample application 2 I get
Current role provider details: AspNetSqlRoleProviderWebApp2, Sample Web Application 2
As these are completely seperate web applications why is "application name" from the 2nd application showing up in the first?
The only thing common as far as I can see is that the database share the same aspnetdb database as well as the same membership provider setup for application name '/' in order to share the users between the applications.