Out-of-process session management is slower than in-process session management but is tolerant of IIS and aspnet_wp.exe restarts and scale for multiprocessor, multi-machine configurations. For a local intranet, the default in-process session management might be suitable. However, if you need some resiliency or can't afford to lose session information, you may want to configure one of the out-of-process session servers.
Configuring SQL Server to Store a Session State
Before you can actually store a session state in SQL server, you need to configure it. This configuration is done via a command line tool called ASPNET_REGSQL.EXE. You can store the session state in three possible locations within the SQL Server:
- Temporary storage: In this case, the session state is stored in the "tempdb" database of SQL Server. The tool creates a database called ASPState and adds certain stored procedures for managing session to it. The tool also creates required tables in the "tempdb" database. If you restart the SQL server, the session data is not persisted.
- Persistent storage: The tool creates a database called ASPState and adds stored procedures for managing a session to it. The session state is stored in the ASPState database. The advantage of this method is that the data is persisted even if you restart the SQL server.
- Custom storage: Both the session state data and the stored procedures are stored in a custom database. The database name must be specified in the configuration file.
The following table lists various command line switches of the tool with respect to session store configuration:
|Command line switch
||Species the IP address or the name of SQL server in which you want to store the session state
||Specifies the user ID to be used when connecting to the SQL Server
||Specifies the password to be used when connecting to the SQL Server
||Indicates that you want to use integrated security when connecting to the SQL Server
||Adds support for the SQLServer mode session state
||Removes support for the SQLServer mode session state
||Type of session state support. This option can be:
t for temporary storage
p for persistent storage
c for custom storage
||The name of the custom database to use if -sstype switch is "c"