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
Entries
News
Articles