providers Element for roleManager (ASP.NET Settings Schema)

Defines a collection of role providers for role management.

configuration Element (General Settings Schema)
  system.web Element (ASP.NET Settings Schema)
    roleManager Element (ASP.NET Settings Schema)
      providers Element for roleManager (ASP.NET Settings Schema)

<providers>
   <add />
   <clear/>
   <remove />
</providers>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements for this section.

Attributes

None.

Child Elements

Element

Description

add

Optional element.

Adds a role provider instance to the collection of role management providers.

clear

Optional element.

Removes all references to inherited role management providers allowing only those added by the current add element.

remove

Optional element.

Removes a reference to an inherited provider from the collection of role management providers.

Parent Elements

Element

Description

configuration

The required root element in every configuration file used by the common language runtime and .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration section.

roleManager

Configures an application for role management.

Remarks

The providers element defines a collection of role providers for role management.

For information about accessing and modifying configuration values for the roleManager element in application code, see the RoleManagerSection class as well as the following Role Providers: WindowsTokenRoleProvider, SqlRoleProvider.

Default Configuration

The following default element element is configured in the machine configuration file.

<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>
</roleManager>

Example

The following example shows an ASP.NET application configured to use the SqlRoleProvider class to store and retrieve role information.

<configuration>
  <system.web>
      <roleManager defaultProvider="SqlProvider" 
                   enabled="true"
                   cacheRolesInCookie="true"
                   cookieName=".ASPROLES"
                   cookieTimeout="30"
                   cookiePath="/"
                   cookieRequireSSL="false"
                   cookieSlidingExpiration="true"
                   cookieProtection="All" >
        <providers>
          <add
            name="SqlProvider"
            type="System.Web.Security.SqlRoleProvider"
            connectionStringName="SqlServices" 
            applicationName="SampleApplication" />
            
        </providers>
      </roleManager>
  </system.web>
</configuration>

Element Information

Configuration Section Handler

RoleManagerSection

Configuration Member

Providers

Configurable Locations

Machine.config

Root level Web.config

Application level Web.config

Requirements

IIS 5.0, IIS 5.1, or IIS 6.0

.NET Framework 2.0

Visual Studio 2003, or Visual Studio 2005

See Also

Tasks

How to: Configure Specific Directories Using Location Settings

How to: Lock ASP.NET Configuration Settings

Reference

roleManager Element (ASP.NET Settings Schema)

add Element for providers for roleManager (ASP.NET Settings Schema)

clear Element for providers for roleManager (ASP.NET Settings Schema)

remove Element for providers for roleManager (ASP.NET Settings Schema)

system.web Element (ASP.NET Settings Schema)

configuration Element (General Settings Schema)

System.Configuration

System.Web.Configuration

RoleManagerSection

RoleManager

Concepts

Understanding Role Management

Securing ASP.NET Configuration

ASP.NET Configuration Scenarios

Other Resources

General Configuration Settings (ASP.NET)

ASP.NET Configuration Settings

ASP.NET Reference

ASP.NET Web Site Administration

ASP.NET Configuration API