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

Describe state management in asp.net?

1018


What is the maximum amount of memory any single process on windows can address?

997


Explain about solution explorer window?

1008


Can we have multiple master pages in asp net?

942


What are the session management techniques asp net?

968


Define the types of configuration files.

939


Difference between application events and session events

995


What is the difference between user control and custom control?

910


How can we call webservices in Banking Applications? and where we are using it?

2033


What describes a query?

885


Disable browser cache for entire ASP.NET website?

1162


What are the namespaces used in asp.net mvc? : asp.net mvc

1031


What are demand-paging and pre-paging?

966


How do you remove duplicates without using remove duplicate stage?

1011


Explain the different types of directives in .net?

901