Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: lock file

  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Posts
    433
    Thanks
    3
    Thanked 0 Times in 0 Posts

    lock file

    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

  • #2
    New Coder
    Join Date
    Jan 2003
    Location
    Peterborough, UK
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Posts
    433
    Thanks
    3
    Thanked 0 Times in 0 Posts

    tsou tsou

    naaa ....very bad solution./// iwant to lock the file


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •