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
14. What are your Future Plans for Swatz Oils GROUP U.K?
Explain the steps to be followed to use passport authentication.
Can you explain architecture of your project ?
Any one can tell how we store tiff format images in database and retrive from the database(need for tiff format only)
To load your generated dataset with data which method do you invoke?
What are all the various Estimation Techniques available ?
What are client activated objects?
What is a page life cycle?
What is the difference between asp.net and mvc?
What is cached data phone?
List of words of preprocessor in .net?
Which dll handles the request of .aspx page?
What are the event handlers that we can have in global.asax file?
What is .net framework and what are the main components of it?
To display data in a Repeater control which template you provide?