Export (0) Print
Expand All

HttpApplicationState.UnLock Method

Unlocks access to an HttpApplicationState variable to facilitate access synchronization.

[Visual Basic]
Public Sub UnLock()
[C#]
public void UnLock();
[C++]
public: void UnLock();
[JScript]
public function UnLock();

Example

The following example uses Lock() and UnLock() to prevent other sessions from changing the value of two application variables until after the local session has changed them.

[Visual Basic] 
Application.Lock()
Application("MyCode") = 21
Application("MyCount") = Convert.ToInt32(Application("MyCount")) + 1
Application.UnLock()

[C#] 
Application.Lock();
Application["MyCode"] = 21;
Application["MyCount"] = Convert.ToInt32(Application["MyCount"]) + 1;
Application.UnLock();


[C++] 
Application->Lock();
Application->Item[S"MyCode"] = __box(21);
Application->Item[S"MyCount"] = __box(Convert::ToInt32(Application->Item[S"MyCount"]) + 1);
Application->UnLock();


[JScript] 
Application.Lock()
Application["MyCode"] = 21
Application["MyCount"] = Convert.ToInt32(Application["MyCount"]) + 1
Application.UnLock()

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpApplicationState Class | HttpApplicationState Members | System.Web Namespace

Show:
© 2014 Microsoft