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

14.04.2008
Application.Lock() and ApplicationUnLock()

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
Comments(0)

Photos
Entries
News
Articles