0

I am using MVC 4 ASP.NET framework.I followed that a Application state can be locked like

Application.Lock();
Application["PageRequestCount"] = 
((int)Application["PageRequestCount"])+1;
Application.UnLock();

Similarly a session state can be locked? if yes how? if not then why?

sujith karivelil
  • 28,671
  • 6
  • 55
  • 88
Ananda G
  • 2,389
  • 23
  • 39

1 Answers1

2

The Application.Lock() method blocks other clients from modifying the variables stored in the Application object, ensuring that only one client at a time can alter or access the Application variables.

Where as Session is for Individual Users, There is no need for locking it and protecting it from other users

sujith karivelil
  • 28,671
  • 6
  • 55
  • 88