ASP.NET Sessions Part 1

This entry is part of a series, ASP.NET Sessions»

ASP.NET provides you with a method of storing data per session.  A session is related to the current user at the present time.  When it operates correctly, a session will span multiple requests for the same user.  This is very useful for example for allowing a user to login and storing their user ID in a session variable (although ASP.NET has other mechanisms for maintaining site logins, I am using this as an example).  There are several factors to consider when using sessions: -

  1. How will ASP.NET maintain the session across multiple requests (how does it know that different requests come from the same user)?
  2. How will the session variables be stored on the server?
  3. How long does a session last?

There are probably other factors, but these are generally the most important ones in my experience.  Each of these factors can be controlled from the configuration/sessionstate element in web.config.  I will go into more detail about this in future posts.  Before that, I will explain how to access the session variables at all.

No related posts.

Tags: , , , , , ,

Leave a Reply