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 ?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

i want to implement grid view value in paypal site. so how to create this code in asp.net with C#

1850


How would you implement inheritance using c#?

988


What are sessions and cookies?

963


How to turn off cookies for a page?

977


How do you remove duplicates without using remove duplicate stage?

1036


What are custom user controls in asp.net?

1004


Explain exception filters?

1013


Explain what the contents of cookie?

1049


How many types of state management are there in asp net?

1011


What is the difference between login controls and forms authentication?

1056


What is clickid?

1033


What is the difference between mvc (model-view-controller) and mvp (model-view-presenter)? : asp.net mvc

1008


What is latest version of asp.net mvc? : Asp.Net MVC

1049


is gateway for sms continue connected for sending sms.how?

2245


What is masterpage?

937