Latest web development tutorials

ASP Lock and Unlock methods

Application Object Reference Complete Application Object Reference

Lock method

Lock method prevents other users from modifying Application object variable (used to ensure the same time only one user can modify Application variables).

Unlock Method

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

grammar

Application.Lock

Application.Unlock

Examples

The following examples use the Lock method to prevent more than one user at the same time access the variable visits, using the Unlock method to unlock a locked object, so the next user can increase the value of the variable 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