User Id :    Password :      New Member   Forgot Password  
 
Managing Session State in a SQL Server
Description In this article we will see how to configure Out-of-Process Session State through SQL-Server   No. of Views     3264
  Rating     0
Author Sumit Gupta   Posted On     16 Feb 2011
Tags ASP.NET,Session Management,C#    

Sample Code   Download Code

Introduction

Out-of-process session management is slower than in-process session management but is tolerant of IIS and aspnet_wp.exe restarts and scale for multiprocessor, multi-machine configurations. For a local intranet, the default in-process session management might be suitable. However, if you need some resiliency or can't afford to lose session information, you may want to configure one of the out-of-process session servers.

 

Configuring SQL Server to Store a Session State

 

Before you can actually store a session state in SQL server, you need to configure it. This configuration is done via a command line tool called ASPNET_REGSQL.EXE. You can store the session state in three possible locations within the SQL Server:

 

  • Temporary storage: In this case, the session state is stored in the "tempdb" database of SQL Server. The tool creates a database called ASPState and adds certain stored procedures for managing session to it. The tool also creates required tables in the "tempdb" database. If you restart the SQL server, the session data is not persisted.
  • Persistent storage: The tool creates a database called ASPState and adds stored procedures for managing a session to it. The session state is stored in the ASPState database. The advantage of this method is that the data is persisted even if you restart the SQL server.
  • Custom storage: Both the session state data and the stored procedures are stored in a custom database. The database name must be specified in the configuration file.
  •  

The following table lists various command line switches of the tool with respect to session store configuration:

 

Command line switch Description
-S Species the IP address or the name of SQL server in which you want to store the session state
-U Specifies the user ID to be used when connecting to the SQL Server
-P Specifies the password to be used when connecting to the SQL Server
-E Indicates that you want to use integrated security when connecting to the SQL Server
-ssadd Adds support for the SQLServer mode session state
-ssremove Removes support for the SQLServer mode session state
-sstype Type of session state support. This option can be:

t for temporary storage
p for persistent storage
c for custom storage

-d The name of the custom database to use if -sstype switch is "c"


 

 

 

About Author

About Author I am Sumit Gupta working in 3 Pillar Global Pvt. Ltd as Module Lead. I have 7+ year of experience in .Net technologies. I love to explore new technologies and write technical article. Sumit Gupta
No Photo
 
Country India
Company 3 Pillar Global Pvt. Ltd.
Home Page http://www.facebook.com/sumitgupta1225

Rate this article

Rating options from poor, fair, good, very good to excelent.  
 

Comments

 
 
Posted By Annonymous on 09 Jun 2011 at 04:08 AM
 
ok hai g.....
 
 
   
Write your comment here.
Comment
Verification Code