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

What does the "EnableViewState" property do?

2 Answers  


How does session id work?

0 Answers  


difference between <connectionstring> <Appsetting>

6 Answers   VebTel,


What is view state and use of it ?

1 Answers  


How would you get asp.net running in apache web servers? Explain it's limitations.

0 Answers  


Explain server-side scripting?

0 Answers  


How Response.flush works in server.Execute ?

1 Answers   Keane India Ltd, TCS,


Name and describe some HTTP Status Codes and what they express to the requesting client ?

1 Answers  


what is diffgram ?

3 Answers  


Explain swagger components.

0 Answers  


What is active web pages?

0 Answers  


How to disable disable browser's Back button in asp.net (JavaScript)?

0 Answers   HCL,


Categories