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

For which does this Codebehind="MyCode.aspx.cs" is relevent to ?

1022


What is an asp.net validator? And, mention its types.

969


Which is the best institute to learn Microsoft Technologies and the faculty if you Know?

2080


What is viewstate? What does the “enableviewstate” property do?

876


What is .net remoting?

993


What is data cache in sql server?

1043


What does passport and windows authentication mean in ASP.NET?

1126


How does the iis work?

974


What is the base class from which web forms are inherited?

947


What is the difference between user control an custom control?

1064


How does u get record no from 5 to 15 from a dataset of 100 records?

906


Explain asp.net application life cycle?

941


What is meant by server side scripting?

896


What are the events in a page life cycle?

899


What is difference between datalist and gridview?

1022