Skip to content

Database Session State

Setting your Session-state to SQLServer ensures that the session is protected if the Web application is disconnected. Doing this will make several Web servers as a backup.

Note: For more detailed steps and explanation, see Microsoft's article on Session-State Modes: http://msdn.microsoft.com/en-us/library/ms178586.aspx

  1. From a Command Prompt, run the following command:

    aspnet_regsql.exe -S .\SQL2005 -E -ssadd -sstype p

    Tip: Replace "SQL2005" with the appropriate database name for your installation.

  2. In the Web.config file, change the mode attribute to SQLServer:

    <sessionState mode ="SQLServer"

  3. Add the sqlConnectionString attribute to the attribute with a value similar to the following:

    sqlConnectionString="Data Source=.\sql2005;User ID=username;Password=password;" cookieless="false" timeout="17"