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 cookieless sessions are supported and sessionstate in can be configured through web.config. In 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 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 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 1805 times
Rohit kakria
I am software developer, moderator of
Related Articles:
Related Interview Questions: