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 |
How to identify host of my system? How to identify servername of my system? How to identify domainname of my system?
what are configuration files?
What is the differances between a abstract calss and interface
In a page there is dropdown list with the name of the cities like Bangalore,Pune,Chennai,Other and a text box that would enable the user to enter the name of the city if other is selected. How to enable validation on the text box if other is selected
What are the Types of authentications in IIS
how can you handle "control is not part of this page " error?
Describe session handling in a webfarm, how does it work and what are the limits?
How do you store a value in viewstate and retrieve them?
I am using ASP.Net 2.0. I added the following code in button_Click page. but 'PreviousPage' is not taking as a keyword. It throughs an error. Page Poster = this.PreviousPage; TextBox txtNewTest = (TextBox)Poster.FindControl("txtTest"); sDisplay = txtNewTest.Text; Response.Write(sDisplay); The following is the Error Message: 'controls_LoginMain' does not contain a definition for 'PreviousPage'
How can we prevent an aspx page get refreshed when any information fetch from the database ?
How can you enable impersonation in the web.config file?
What is the differences between a primary key and a unique key in sql server?