Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Is it necessary to lock application state before accessing it ?



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

Post New Answer

More ASP.NET Interview Questions

Describe session handling in a webfarm, how does it work and what are the limits?

0 Answers   Siebel Systems,


Can I stream live content/events?

0 Answers  


Is react a template engine?

0 Answers  


How To Send Value one page to Another Page On MasterMenu Click ? please Tell Me!

3 Answers   Accenture,


What is the postback property in asp.net?

0 Answers  


How to manage pagination in a page?

2 Answers  


How can you get public key information?

1 Answers   Microsoft,


Explain why it is useful to use mvc instead of webforms? : asp.net mvc

0 Answers  


how to retrieve data using web services in asp.net pls give me the code and explain me briefly

3 Answers  


Explain the steps to be followed to use passport authentication.

0 Answers  


What are the different web pages?

0 Answers  


what is CLR?

3 Answers   PrimeLine,


Categories