To configure your session state database Microsoft has created a command line tool which will create the database for you. You can find the tool in the .NET framework folder. You must use the tool which corresponds to the framework version you are using. In my case I am using .NET 4.0 64 bit.

1. Browse to this location:

C:\Windows\system32>cd  C:\Windows\Microsoft.NET\Framework64\v4.0.30319

2. Run these commands substituting ‘ServerName’ for the SQL server you wish to create the database on:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regsql.exe -S ServerName -E -ssadd -sstype p
Microsoft (R) ASP.NET SQL Registration Tool version 4.0.30319.33440
Administrative utility to install and uninstall ASP.NET features on a SQL server
Copyright (C) Microsoft Corporation. All rights reserved.

Start adding session state.



3. You Should now see a new database appear on the SQL Server


Once you have the database in place you can configure IIS to save the sessions in the database.

The Development team will need to update the web.config file to use the SQL server:

Using default security:
<sessionstate mode="SQLServer" timeout="20" allowcustomsqldatabase="true" 
sqlconnectionstring="Data Source=Server;User ID=UserID;Password=Password;" 

Using Windows authentication:
<sessionstate mode="SQLServer" timeout="20" allowcustomsqldatabase="true" 
sqlconnectionstring="Data Source=Server;Integrated-Security=SSPI;" 

We use cookies to give you the best online experience. By agreeing you accept the use of cookies in accordance with our cookie policy.

Privacy Settings saved!
Privacy Settings

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. Control your personal Cookie Services here.

These cookies are necessary for the website to function and cannot be switched off in our systems.

In order to use this website we use the following technically required cookies
  • wordpress_test_cookie
  • wordpress_logged_in_
  • wordpress_sec

Decline all Services
Accept all Services