Automatic SQL Server State Management

If you have an installation of SQL Server available to you, you might want to consider moving your session state management to SQL Server, especially if session state is of critical importance to your application and you can't afford to lose the session state for a user. When you send persistent session data to a SQL Server database, the data not only will survive the restarting of Web services but also a restart of the whole machine.

Follow these steps to use SQL Server to manage your state:

1.
Open the Web.Config file in the Visual Studio .NET editor.
2.
Locate the <sessionState> XML element.
3.
Change the Mode attribute to SQLServer.
4.
Make sure the Cookieless attribute is set to True.
5.
Change ...

Get ASP.NET Developer's JumpStart now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.