...

View Full Version : lock file



alaios
02-21-2003, 11:53 AM
hi i want to lock and unlock filesin asp periodically? i want to stop the access from other users...do u know how i can do this ?thx

raven
02-21-2003, 01:10 PM
An application variabale might be the best bet. Create 2 new files, lock.asp and unlock.asp with the following code:

lock.asp:

<%
Application("iFileLock") = 1
Response.write "File locked"
%>

unlock.asp:

<%
Application("iFileLock") = 0
Response.write "File unlocked"
%>

Then, at the top of the code for the file you want to lock add this:

<%
If Application("iFileLock") = 1 then
Response.write "File locked"
Response.end
End if
%>

Obviously, you could change the messages being written or the action taken when the value of the variable is 1.

To lock the file, just access lock.asp. To unlock, access unlock.asp.

alaios
02-22-2003, 11:40 PM
naaa ....very bad solution./// iwant to lock the file



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum