Live Chat Icon For mobile
Live Chat Icon

Does session state have a locking mechanism that serialize the access to state?

Platform: ASP.NET| Category: Session

Session state implements a reader/writer locking mechanism:

  • 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

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.