This documentation is archived and is not being maintained.

SessionStateSection Class

Configures the session state for a Web application.

Namespace:  System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)

public sealed class SessionStateSection : ConfigurationSection

The SessionStateSection class refers to the element in the Machine.config or Web.config configuration file identified by the sessionState tag.

When a new client begins interacting with a Web application, a session ID is issued and associated with all the subsequent requests from the same client during the time the session is valid. This ID is used to maintain server-side state associated with the client session across requests. The SessionStateSection controls how the ASP.NET application establishes and maintains this association on behalf of each client.

This mechanism is very flexible and gives you the ability to host session-state information out of process and to track state without using cookies, among other things.

This section provides two code examples. The first demonstrates how to specify values declaratively for several attributes of the sessionState section, which can also be accessed as members of the SessionStateSection class. The second demonstrates how to use the T:System.Web.Configuration.SessionStateSection class.

The following configuration file example shows how to specify values declaratively for the sessionState section.

    <sessionState mode="InProc" 
      sqlConnectionString="data source=;
        Integrated Security=SSPI"
        <clear />

The following code example demonstrates how to use the T:System.Web.Configuration.SessionStateSection class.

// Get the Web application configuration object.
System.Configuration.Configuration configuration =

// Get the section related object.
System.Web.Configuration.SessionStateSection sessionStateSection =

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0