ASP.NET SQL Server Session - Links and Overview

A co-worker asked me about setting up SQL Server Session state. Here's what I told him:

Basic steps to set up SQL Server Session state

1. Run either of these scripts (InstallSqlState uses temp tables, InstallPersistSqlState uses permanent tables so it survives reboots)
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\InstallSqlState.sql
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\InstallPersistSqlState.sql

2. Change your session state mode in web.config to SQLServer:
<sessionState
  mode="SQLServer"
  sqlConnectionString="data source=server;user id=uid;password=pwd"
  cookieless="false" timeout="20" />

References

Good overview http://idunno.org/dotNet/sessionState.aspx

MSDN overview of SQL Server Session State
http://support.microsoft.com/default.aspx?kbid=311209

[UPDATE]
Another good article with information on granting permissions on SQL Server:
http://www.dbazine.com/cook9.shtml

Common issues

325056 PRB: Session State Is Lost in Web Farm If You Use SqlServer or
http://support.microsoft.com/?id=325056
323744 FIX: "The View State Is Invalid for This Page and Might Be Corrupted"
http://support.microsoft.com/?id=323744

No Comments