SessionStateSection Class
Collapse the table of content
Expand the table of content
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
public final class SessionStateSection extends ConfigurationSection
public final class SessionStateSection extends ConfigurationSection
Not applicable.

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 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
© 2016 Microsoft