Export (0) Print
Expand All

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

Adds a provider to the collection of session-state store providers.

configuration Element (General Settings Schema)
  system.web Element (ASP.NET Settings Schema)
    sessionState Element (ASP.NET Settings Schema)
      providers Element for sessionState (ASP.NET Settings Schema)
        add Element for providers for sessionState (ASP.NET Settings Schema)
<add 
    name="provider name" 
    type="fully qualified type reference"
/>

The following sections describe the attributes, child elements, and parent elements.

Attributes

Attribute

Description

name

Required String attribute.

Specifies the name of the provider instance. This is the value that is used for the customProvider attribute of the sessionState element to identify the provider instance as the session-state store provider when the mode attribute of the sessionState element is set to the Custom value.

type

Required String attribute.

Specifies the type that is implementing the SessionStateStoreProviderBase abstract base class.

The value must be a fully qualified reference to the assembly.

Child Elements

None.

Parent Elements

Element

Description

configuration

Required root element in every configuration file that is used by the common language runtime and the .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration settings in a configuration file and contains configuration elements that configure ASP.NET Web applications and control how the applications behave.

sessionState

Configures session-state settings for the current application.

providers

Contains a collection of custom session-state store providers.

The add element adds a provider to the collection of session state store providers in the providers element. The providers element contains a collection of custom session-state store providers. The custom session-state store provider must inherit from the SessionStateStoreProviderBase class.

For information about how to access and modify configuration values for the sessionState element in application code, see ProviderSettingsCollection and Providers.

The following code example shows how to use the Web.config file for an ASP.NET application that is configured to use a custom session-state store provider. For information about how to implement a session-state store provider, including a sample provider, see Implementing a Session-State Store Provider.

<configuration>
  <connectionStrings>
    <add name="OdbcSessionServices" connectionString="DSN=SessionState;" />
  </connectionStrings>

  <system.web>
    <sessionState 
      cookieless="true"
      regenerateExpiredSessionId="true" 
      mode="Custom"
      customProvider="OdbcSessionProvider">
      <providers>
        <add name="OdbcSessionProvider"
          type="Samples.AspNet.Session.OdbcSessionStateStore"
          connectionStringName="OdbcSessionServices" 
          writeExceptionsToEventLog="false" />
      </providers>
    </sessionState>
  </system.web>
</configuration>

Configuration section handler

SessionStateSection

Configuration member

Providers

Configurable locations

Machine.config

Root-level Web.config

Application-level Web.config

Requirements

Microsoft Internet Information Services (IIS) version 5.0, 5.1, or 6.0

The Microsoft .NET Framework version 2.0

Microsoft Visual Studio 2003 or Visual Studio 2005

Community Additions

ADD
Show:
© 2014 Microsoft