Name

UnLock

Synopsis

Application.UnLock

Unlocks access to an Application collection to facilitate access synchronization.

Parameters

None

Example

The example locks the application, sets an application page load counter variable, unlocks the application, and displays the value:

Sub Page_Load(  )
   Application.Lock(  )
   Application("Counter") = Application("Counter") + 1
   Application.UnLock(  )
   Message.Text = "Counter = " & Application("Counter") 
End Sub

Notes

In the example, note that we Lock the application, perform any operations that modify values within the Application collection, and UnLock the application as quickly as possible. Any read access to the Application collection can safely take place outside the Lock/UnLock method calls.

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.