Search code examples
c#asp.netsql-serversessionsql-session-state

Is it possible to share SQL Server database for storing session state in Asp.Net Web Forms


I have an Asp.Net web forms application that uses the session state stored in SQL Server.

I have created this session state database following this article - execute the script InstallSqlState.sql located in system drive\Windows\Microsoft.NET\Framework\version\:

https://support.microsoft.com/en-us/help/317604/how-to-configure-sql-server-to-store-asp-net-session-state

Is it necessary for another application create separate database for storing session state?

What is best practice - keep session state in one database or use separate databases?

If I only use one session state database per both applications - are there some issues - maybe security issue etc?


Solution

  • Ideally you should not share the session across the applications, as the default scripts provided are only meant for one application. If you want to support multiple applications you need to change the provided code which is not correct.

    If you share, you may end up with performance bottlenecks and locking issues.

    To make it happen check this SO Post