Saturday, August 25, 2007

ApplicationName" property & its importance while configuring ASP.NET 2.0 role & membership features

Why applicationName ?
applicationName is provided so as to enable us to map different applications to same database

this is a sample configuration for the ASP.net 2.0 Roles



<roleManager>

<providers>

<add name="AspNetSqlRoleProvider"
connectionStringName="LocalSqlServer" applicationName="/"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=
2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />


<add name="AspNetWindowsTokenRoleProvider"
applicationName="/"
type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=
2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />


</providers>



you develop the site using all the advanced features its works perfectly but when the site is exported / published on another server, these features wont work !!!!

The problem
when we are using the 2.0 features asp.net automatically uses the virtual root folder name of the application if does not find any value for the applicationName value in the .config files.

When we export the same configuration it no longer works because the 2.0 features are configured for some vroot which is not available in the new environment.

Solution:

· Always provide some value to the applicationName (its not a must, but a good practice)

· Provide "/" as the value

Post a Comment