Ananda G
Ananda G

Reputation: 2539

can a Sesioon state be locked

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?

Upvotes: 0

Views: 56

Answers (1)

sujith karivelil
sujith karivelil

Reputation: 29036

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

Upvotes: 2

Related Questions