Configure Session Time-out (IIS 7)
Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista
When session state is enabled for your application, a user receives a unique session ID on their first request to a Web page from your Active Server Pages (ASP) application. By default, the session expires when the user has not requested or refreshed a page in the ASP application for 20 minutes. Because Session objects consume memory on the Web server, you may want to decrease the time-out value to conserve resources.
Important
Use caution when you adjust the session time-out value, because information stored in a user's Session object is lost when time-out occurs.
Prerequisites
For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see Session State Feature Requirements (IIS 7).
Exceptions to feature requirements
- None
To configure session timeout
You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.
User Interface
To Use the UI
Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).
In Features View, double-click ASP.
On the ASP page, under Services, expand Session Properties.
In the Time-out field, enter a time-out value in the format hh:mm:ss. For example, enter 00:15:00 for 15 minutes.
In the Actions pane, click Apply.
Command-line
To specify the default period of time that a session object is maintained after the last request associated with the object is made, use the following syntax:
**appcmd set config /section:asp /timeout:**timeSpan
The variable timeSpan represents the maximum period of time (hh:mm:ss) that a session object is maintained after the last request associated with the object is made. The default value is 00:20:00.
For more information about Appcmd.exe, see Appcmd.exe (IIS 7).
Configuration
The procedure in this topic affects the following configuration elements:
<sessionState>
<sessionPageState>
For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.
WMI
Use the following WMI classes, methods, or properties to perform this procedure:
- SessionStateSection.Timeout property
For more information about WMI and IIS, see Windows Management Instrumentation (WMI) in IIS 7. For more information about the classes, methods, or properties associated with this procedure, see the IIS WMI Provider Reference on the MSDN site.