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

I have a component with 3 parameter and deployed to client side now i changed my dll method which takes 4 parameter.How can i deploy this without affecting the clent?s code ?

1 Answers   Microsoft, Satyam, Wipro,


how can we create wcf in asp.net and how can we cll that in to asp.net application?plsss tel me each step clearly

0 Answers  


What is the use of asp.net web api?

0 Answers  


How to send data through querystring to another page but it should not be displayed in URL

2 Answers   EMR, Powersoft19,


Why would anyone need to implement their own hashtable or linked list?

0 Answers  


What is the < machinekey > element and what two ASP.NET technologies is it used for ?

1 Answers  


how can u create the blog in asp.net with C#?what is the data type u will use to store in sql server?

0 Answers   IBM,


Explain a program using code nuggets to create a simple application? : asp.net mvc

0 Answers  


What is the life-span of the items in the viewstate?

0 Answers  


What are the event handlers that we can have in global.asax file?

0 Answers  


Explain what is an abstract class?

0 Answers  


What are session cookies?

0 Answers  


Categories