Jun 28

What are session management techniques in .NET?

There are three different techniques of managing session in ASP.NET
InProc 
Session state is stored locally in memory of ASP.NET worker process.

StateServer 
Session state is stored outside ASP.NET worker process and is managed by Windows service. Location of this service is specified by stateConnectionString attribute.

SQLServer 
Session state is stored outside ASP.NET worker process in SQL Server database. Location of this database is represented by sqlConnectionString attribute.


InProc

Adv.:
1) Faster as session resides in the same process as the application
2) No need to serialize the data

DisAdv.:
1) Will degrade the performance of the application if large chunk of data is stored
2) On restart of IIS all the Session info will be lost

State Server
Adv.:
1) Faster then SQL Server session management
2) Safer then InProc. As IIS restart
won’t effect the session data

DisAdv.:
1) Data need to be serialized
2) On restart of ASP.NET State Service session info will be lost
3)Slower as compared to InProc

SQL Server
Adv.:
1) Reliable and Durable
2) IIS and ASP.NET State Service
restart won’t effect the session data
3) Good place for storing large chunk of data

DisAdv.:
1) Data need to be serialized
2) Slower as compare to InProc and State Server
3)Need to purchase Licensed
version of SQL Server

Permanent link to this article: http://zappmania.in/2012/06/28/what-are-session-management-techniques-in-net.htm

Leave a Reply

Your email address will not be published.