Is it necessary to lock application state before accessing it ?
Answer / kumar saurabh
Only if you're performing a multistep update and want the update to be treated as an atomic operation. Here's an example:
Application.Lock ();
Application["ItemsSold"] = (int) Application["ItemsSold"] + 1;
Application["ItemsLeft"] = (int) Application["ItemsLeft"] - 1;
Application.UnLock ();
By locking application state before updating it and unlocking it afterwards, you ensure that another request being processed on another thread doesn't read application state at exactly the wrong time and see an inconsistent view of it.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the maximum number of classes that can be contained in one dll file?
What is __ requestverificationtoken?
What is the difference between a candidate key and primary key?
Can i have both C# and vb.net code in same assembly?how?
Explain some of the major built-in objects in asp.net
When you are running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?
Write some code using interfaces, virtual methods, and an abstract class`
What r all the controls in ASP.NET ?
I have one application, one user purchase some products in my application? and another person came he is also purchase some products?how can we identify which user purchase which items? my answer is by using session id? but i dont know how? can u give me programming for that?
what is the difference between response.write() and response.output.write()?
What is difference between session and cookies?
Suppose i create one application in vs 2008 and it is running in the latest version of IE,will it run in netscape and other browsers with low version?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)