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
i want to implement grid view value in paypal site. so how to create this code in asp.net with C#
How would you implement inheritance using c#?
What are sessions and cookies?
How to turn off cookies for a page?
How do you remove duplicates without using remove duplicate stage?
What are custom user controls in asp.net?
Explain exception filters?
Explain what the contents of cookie?
How many types of state management are there in asp net?
What is the difference between login controls and forms authentication?
What is clickid?
What is the difference between mvc (model-view-controller) and mvp (model-view-presenter)? : asp.net mvc
What is latest version of asp.net mvc? : Asp.Net MVC
is gateway for sms continue connected for sending sms.how?
What is masterpage?