Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ASP Lock and Unlock Methods

ASP Lock and Unlock Methods


Application Object Reference Complete Application object reference manual


The Lock Method

The Lock method prevents other users from modifying variables in the Application object (to ensure that only one user can modify Application variables at a time).

The Unlock Method

The Unlock method allows other users to modify variables stored in the Application object (after it has been locked with the Lock method).

Syntax

Application.Lock

Application.Unlock

Example

The following example uses the Lock method to prevent more than one user from accessing the visits variable at the same time, and uses the Unlock method to unlock the object so the next user can increment the value of visits:

<%

Application.Lock

Application("visits")=Application("visits")+1

Application.Unlock

%>

This page has been visited

<%=Application("visits")%> times!


Application Object Reference Complete Application object reference manual