November 20, 2009 05:09 by
Admin
Session state
Session state is a collection of user-defined session variables, which are persisted during a user session. These variables are unique to different instances of a user session, and are accessed using the Session collection. Session variables can be set to be automatically destroyed after a defined time of inactivity, even if the session does not end. At the client end, a user session is identified either by a cookie or by encoding the session ID in the URL itself.[11]
ASP.NET supports three modes of persistence for session variables:[11]
In Process Mode
The session variables are maintained within the ASP.NET process. This is the fastest way; however, in this mode the variables are destroyed when the ASP.NET process is recycled or shut down. Since the application is recycled from time to time this mode is not recommended for critical applications, rather in practice this mode is not recommended for any applications.
ASPState Mode
In this mode, ASP.NET runs a separate Windows service that maintains the state variables. Because the state management happens outside the ASP.NET process and .NET Remoting must be utilized by the ASP.NET engine to access the data, this mode has a negative impact on performance in comparison to the In Process mode, although this mode allows an ASP.NET application to be load-balanced and scaled across multiple servers. However, since the state management service runs independent of ASP.NET, the session variables can persist across ASP.NET process shutdowns.
The same problem arises though - since session state server runs as a single instance it is a single point of failure as far as session state is concerned. This service can not be load balanced and also imposes restrictions on types that can be stored in a session variable.
SqlServer Mode
In this mode, the state variables are stored in a database server, accessible using SQL. Session variables can be persisted across ASP.NET process shutdowns in this mode as well. The main advantage of this mode is it would allow the application to balance load on a server cluster while sharing sessions between servers. This is the slowest method of session state management in ASP.NET.
2089ae8b-d68c-4d5e-99a9-8952586cf4cb|0|.0