views:

70

answers:

2

I am at a loss how to maintain it on a web farm. Could somebody tell me how to use sqlserver to maintain it?

+2  A: 

To use SQL Server you have to modify the web.config settings for Session state to change it from InProc. You will then need to create the database and configure. THis article walks you through the process.

So basically you have a few parts to it.

  1. Setup the database in the proper format, using the .NET Framework tool
  2. Modify the web.config to change the session state type, and provide the information to the DB.
Mitchel Sellers
+1  A: 

You don't need to use SQL Server to maintain state on a web-farm - you can also use StateServer mode, which MSDN describes as:

"StateServer mode, which stores session state in a separate process called the ASP.NET state service. This 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."

You can set-it up easily in web.config eg.

<configuration>
  <system.web>
    <sessionState mode="StateServer"
      stateConnectionString="tcpip=SampleStateServer:42424"
      cookieless="false"
      timeout="20"/>
  </system.web>
</configuration>

Note, 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.

Dan Diplo