HomeGuidesRecipesAPI
HomeGuidesAPILog In

SQL Server Session States

Overview

Infiniti can be configured to utilize SQL Server Session States. This is achieved with the use of a SQL Server user and an entry into the Produce and Manage web.config files.

By default the session state for web applications is stored in memory. This can cause issues for load balanced web servers or if an IIS worker process is restarted, the state can be lost. Mostly this affects the wizard information which people do not want to lose.

ASP.net session state could always be configured to be stored in a database however there is a performance penalty to enabling it for large projects, projects with data source, or those that allow file uploads.

To enable it a database must be created and the config files need to be changed.

Description

Create State Database

  1. Open a command prompt to the path c:\Windows\Microsoft.NET\Framework64\v4.0.30319
  2. Run the command aspnet_regsql -S -E -ssadd -sstype p
  3. This will create a ASPState database with the needed tables, stored procedures, and sql tasks.
  4. Create a SQL Server user (eg SqlAspState) and make them a db_owner of the ASPState database

Modify Config Files

Insert the following text into both the Produce and Manage web.config files.

<sessionState mode="SQLServer" sqlConnectionString="YOURINFINITIDBCONNECTIONSTRING" cookieless="false" timeout="20" compressionEnabled="true" />

📘

Note

The SQL user specified within the sqlConnectionString attribute only requires standard read/write privileges.