Specify a Custom Session State Provider (IIS 7)
Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista
You can use a custom provider to handle session state for the ASP.NET applications on your Web server. The provider creates the necessary connection to the database where session state information is stored. Following are the two primary reasons to use a custom session-state store provider:
You want to store session-state information in a data source other than SQL server, such as a FoxPro database or an Oracle database.
You must manage session-state information that uses a database schema that differs from the database schema that is used by the providers that are included with the .NET Framework. An example of this would be shopping cart data that is stored with a pre-defined schema in an existing SQL server database for a company or site.
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
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.
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 Session State.
On the Session State page, in the Session State Mode Settings area, click Custom.
Click Apply in the Actions pane.
To specify a custom state provider, use the following syntax:
appcmd set config /commit:WEBROOT /section:sessionState /mode:Custom
The variable mode:Custom specifies a custom state provider.
|When you use Appcmd.exe to configure the <sessionState> element at the global level in IIS 7, you must specify /commit:WEBROOT in the command so that configuration changes are made to the root Web.config file instead of ApplicationHost.config.|
For more information about Appcmd.exe, see Appcmd.exe (IIS 7).
The procedure in this topic affects the following configuration elements:
For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.
Use the following WMI classes, methods, or properties to perform this procedure:
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.
ConceptsConfiguring Session State in IIS 7