ASP.NET Blog

June 25, 2008

About EnableSessionState attribute -

  • A page (or frame) that has session state write access (e.g. <%@ Page EnableSessionState=”True” % > ) will hold a writer lock on the session until the request finishes.
  • A page (or frame) that has session state read access (e.g. <%@ Page EnableSessionState=”ReadOnly” % > ) will hold a reader lock on the session until the request finishes.
  • Reader lock will block a writer lock; Reader lock will NOT block reader lock; Writer lock will block all reader and writer lock.
  • That’s why if two frames both have session state write access, one frame has to wait for the other to finish first.

 When setting Cookieless=true then

  1. You cannot use absolute link in your pages.
  2. You have to perform additional steps to switch between http and https pages in your application.
  3. If your customer sends a link to a friend, the URL will contain the session ID and both users could be using the same session ID at the same time.

 

Difference between Session.Abandon(), Session.Clear() -

The major difference is that if you call Session.Abandon(), Session_End will be fired (for InProc mode), and in the next request, Session_Start will be fired. Session.Clear( ) just clears the session data without killing it.

Que. Why aren’t my sessions expiring, I am using SQLServer mode?