Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




Session management in ASP.Net

In ASP.net cookieless sessions are supported and sessionstate in ASP.net can be configured through web.config. In ASP.net sessions can be configured in three ways.

1. In-Proc (In Process)
2. State Server (Out Process)
3. SQL Server(Database)

1. In-Proc : In this mode the sessions are stored in the memory of the ASP.NET worker process. Thus, this mode offers the fastest access to stored session values. However, when the ASP.NET worker process recycles, the session data is lost.

2. State Server: It is accomplished by setting the sessionstate mode in web.config to StateServer. In this mode the session data is stored in a separate in memeory cache which is controlled by window service on a separate machine. The state service called asp.net state service (aspnet_state.exe) is configured using stateconnectionstring attribute in the web.config file. e.g.

<sessionstate mode="StateServer" stateconnectionstring="tcpip=myserver:42424" 
cookieless="false" timeout="20/&gt;"></sessionstate>

3. SQL Server : This mode can be configured setting the sessionstate mode to "SQL Server". In this the asp.net stores session data into SQL Server specified by a connection string attribute that contains datasource and security credentials. To configure appropriate database ASPState database needs to be created by running InstallState.sql script in the required database.

Share this article   |    Print    |    Article read by 1962 times
Author:
Rohit kakria
I am software developer, moderator of xpode.com
Related Articles:
Related Interview Questions: