Türkçe   |   English
Calendar
Categories
Archive
Links
Blogroll
Files

Application.Lock() and ApplicationUnLock() - 14.04.2008

As all of we know, in web applications if we want to keep a global variable that applies to all users and sessions, we can use the ApplicationState. Since ApplicationState can be accessed by more than one thread at the same time, in order to prevent the Application object's value to be set in more than one thread, while setting a value to an Application object, we should call the Lock method of the Application object, set its value and call the UnLock method so that its value is freed for other threads to set:

Application.Lock();
Application["isil"] = "asdasd";
Application.UnLock();

Code

Add Comment
First Name Last Name
Web Site
E-Mail
Comment
Security Picture

Photos
Me in MSDN Forums
-   Answered the question How can i get it in the Visual C# General forum
-   Answered the question How to add the VAT to the ammount in the Visual Basic General forum
-   Contributed a proposed answer to the question How to add the VAT to the ammount in the Visual Basic General forum
-   Replied to the question How can i get it in the Visual C# General forum
-   Replied to the question How to add the VAT to the ammount in the Visual Basic General forum
-   Answered the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
-   Contributed a proposed answer to the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
-   Answered the question Expert to Excel Missing Some Data In Grid View in the Visual C# Language forum
-   Contributed a helpful post (total votes:1) to the forums thread Expert to Excel Missing Some Data In Grid View in the Visual C# Language forum
-   Replied to the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
Entries
News
Articles