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 a Windows Service and its lifecycle ?

0 Answers   Siebel,


Explain code snippet to register exception filters from controller?

0 Answers  


Explain the asp.net session state modes.

0 Answers  


What are the elements of a website?

0 Answers  


How you can add an event handler?

0 Answers  


Differentiate between authentication and authorization.

0 Answers  


What methods are fired during the page load? Init()

0 Answers  


Explain how can we access static variable?

0 Answers  


Trigger syntax in sql2000

1 Answers   Wipro,


If Asp Dot Application is stateless what happened? during designing

3 Answers   TCS,


What is the application pool?

0 Answers  


what is caching

3 Answers  


Categories