System.Web Namespace HttpApplicationState Class
Locks access to an HttpApplicationState variable to facilitate access synchronization.
[ VB ]
Public Sub Lock ( )
[ C# ]
public void Lock ( );
[ C++ ]
public: void Lock ( );
[ JScript ]
public function Lock ( );
The following example uses Lock ( ) and UnLock ( ) to prevent other sessions from changing the value of an application variable until after the local session has changed them.
Application.Lock ( );
Application [ "myPageHits" ] = Convert.ToInt32 ( Application [ "myPageHits" ] ) + 1;
Application.UnLock ( );
Application.Lock ( )
Application ( "myPageHits" ) = Convert.ToInt32 ( Application ( "myPageHits" ) ) + 1
Application.UnLock ( )
Application.Lock ( );
Application [ "myPageHits" ] = Convert.ToInt32 ( Application [ "myPageHits" ] ) + 1;
Application.UnLock ( ); |
|
C# |
VB |
JScript |
HttpApplicationState Members