Is it necessary to lock application state before accessing it ?
Answer Posted / 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 |
Post New Answer View All Answers
For which does this Codebehind="MyCode.aspx.cs" is relevent to ?
What is an asp.net validator? And, mention its types.
Which is the best institute to learn Microsoft Technologies and the faculty if you Know?
What is viewstate? What does the “enableviewstate” property do?
What is .net remoting?
What is data cache in sql server?
What does passport and windows authentication mean in ASP.NET?
How does the iis work?
What is the base class from which web forms are inherited?
What is the difference between user control an custom control?
How does u get record no from 5 to 15 from a dataset of 100 records?
Explain asp.net application life cycle?
What is meant by server side scripting?
What are the events in a page life cycle?
What is difference between datalist and gridview?