3
votes

We want to store session in SQL Server. We have sessionState mode="SQLServer". I have been given a sample connectionstring as listed below. In this it is having both stateConnectionString and sqlConnectionString.

Question: Why do we need stateConnectionString when mode="SQLServer"?

<sessionState mode="SQLServer" 
cookieless="false" timeout="20" 
stateConnectionString="tcpip=XXX.XX.XXX.XXX:42424" 
sqlConnectionString="data source=XXX-FFFF-sql2k8,2025;
Initial   Catalog=AspState_XX_3_0;user id=XXX;password=XXX" 
allowCustomSqlDatabase="true" 
sqlCommandTimeout="1200"/>

Note 1: SQLServer mode stores session state in a SQL Server database. Using this mode ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm. To use SQLServer mode, you must first be sure the ASP.NET session state database is installed on SQL Server. You can install the ASP.NET session state database using the Aspnet_regsql.exe tool

Note 2: StateServer mode stores session state in a process, referred to as the ASP.NET state service, that is separate from the ASP.NET worker process or IIS application pool. To use StateServer mode, you must first be sure the ASP.NET state service is running on the server used for the session store. To use StateServer mode in a Web farm, you must have the same encryption keys specified in the machineKey element of your Web configuration for all applications that are part of the Web farm.

1

1 Answers

4
votes

AFAIK you can skip the StateConnectionString when storing sessionstate in SQL Server.

I haven't tried it, but it seems to be confirmed here: http://support.microsoft.com/kb/317604