ASP.NET Syntax ASP.NET Configuration Sections
Configures the session state HttpModule.
<sessionState
mode = "Off | Inproc | StateServer | SqlServer"
cookieless = "true | false"
timeout = "number of minutes"
connectionString = "server name:port number"
sqlConnectionString = "sql connection string"
/>
The <sessionState
> tag supports five attributes.
Attribute |
Option |
Description |
mode |
|
Specifies where to store the session state. |
|
Off |
Indicates that session state is not enabled. |
|
Inproc |
Indicates that session state is stored locally. |
|
StateServer |
Indicates that session state is stored on a remote server. |
|
SqlServer |
Indicates that session state is stored on a SQL Server. |
cookieless |
|
Specifies whether sessions without cookies should be used to identify client sessions. |
|
true |
Indicates that sessions without cookies should be used. |
|
false |
Indicates that sessions without cookies should not be used. The default is false. |
timeout |
|
Specifies the number of minutes a session can be idle before it is abandoned. The default is 20. |
connectionString |
|
Specifies the server name and port where session state is stored remotely. For example, "127.0.0.1:42424". This attribute is required when mode is set to "StateServer". |
sqlConnectionString |
|
Specifies the connection string for a SQL Server. For example, "data source=127.0.0.1;user id=sa; password=". This attribute is required when mode is set to "SqlServer". |
The following example specifies several session state configuration settings.
<configuration>
<system.web>
<sessionState
mode = "Inproc"
cookieless = "true"
timeout = "20" />
</system.web>
</configuration>
ASP.NET Configuration SessionStateSection Class