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 is difference between view and partial view?

0 Answers  


Explain how dot net compiled code will become platform independent?

0 Answers  


List the types of authentication supported by asp.net?

0 Answers  


What are the differences between primary foreign and unique keys?

0 Answers  


Why is catch(Exception) almost always a bad idea?

4 Answers  


what is soap?

5 Answers   Cognizant, Microsoft, NCR,


What is cross page posting in asp net?

0 Answers  


How do I debug an ASP.NET application that wasn't written with Visual Studio.NET and that doesn't use code-behind?

1 Answers  


can we pass values from one page to another page without redirecting to that page?

6 Answers   Google, Patni, Syntel, Wipro,


What is application variable?

0 Answers  


How Session use Cookies in State Management?

0 Answers  


How to automatically get the latest version of all the asp.net solution items from source safe when opening the solution?

0 Answers  


Categories