Personal Web & Sample Site
Skip Navigation Links
HOME |
About Me |
Articles
| Contact Us
Session State
Rating: 8 user(s) have rated this article Average rating: 5.0
Posted by: joet, on 9/9/2011, in category "ASP.NET"
Views: this article has been read 2165 times
Location: Houston, Tx, United States
Abstract: What is "Session State"? This article describes the use of session state and how it's used on the server.

 

Server-side session state is held by a collection of user-defined session variables that are persistent during a user session. These variables, accessed using the Session collection, are unique to each session instance. The variables can be set to be automatically destroyed after a defined time of inactivity even if the session does not end. Client-user session is maintained by either a cookie or by encoding the session ID in the URL itself. ASP.NET supports three modes of persistence for server-side session variables.

  • In-Process Mode
  • ASPState Mode
  • SqlServer Mode
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.
ASPState Mode
ASP.NET runs a separate Windows service that maintains the state variables. Because state management happens outside the ASP.NET process, and because the ASP.NET engine accesses data using .NET Remoting, ASPState is slower than In-Process. This mode allows an ASP.NET application to be load-balanced and scaled across multiple servers. Because the state management service runs independently of ASP.NET, the session variables can persist across ASP.NET process shutdowns. However, since session state server runs as one instance, it is still one point of failure for session state. The session-state service cannot be load-balanced, and there are restrictions on types that can be stored in a session variable.
SqlServer Mode
State variables are stored in a database, allowing session variables to be persisted across ASP.NET process shutdowns. The main advantage of this mode is that it allows the application to balance load on a server cluster, sharing sessions between servers. This is the slowest method of session state management in ASP.NET.


How would you rate this article?

User Feedback

Post your comment
Name:
E-mail:
Comment:
Insert Cancel

Copyright © 2013 Jose M. Tamez
Last Updated August 18th 2013