Permission denied

Results 1 to 2 of 2

Thread: Permission denied

  1. #1
    Join Date
    Dec 1969

    Default Permission denied

    Every now and then I get this Permission Denied error when calling the function below at the &#039;DeleteFile&#039; statement (so not always, but sometimes).<BR>I think it&#039;s because the file is at some point in use by another visitor. The global idea is that the site is using a cached html file and needs to be deleted when it updates. The function below is executed when the dynamic page is updated.<BR>Any idea how I can prevent this error?<BR><BR>Function DeleteCache(bestandsnaam)<BR><BR> Application.Lock<BR><BR> Set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR> <BR> bestand = Cachefolder & "\" & bestandsnaam<BR> <BR> If objFSO.FileExists(bestand) Then<BR> <BR> objFSO.DeleteFile bestand, True<BR> <BR> End If <BR> <BR> Set objFSO = Nothing<BR> <BR> Application.UnLock<BR><BR>End Function

  2. #2
    Join Date
    Dec 1969

    Default Doesn't do any good... put the Application.Lock/Unlock around this code unless you *also* put it around whatever code needs to read the file.<BR><BR>Say user 1 is reading the file and user 2 comes along and decides to update it. So user 2 locks the app and tries the DELETEFILE. Oops. File in use. Because user 1 didn&#039;t do an app lock and so user 2 doesn&#039;t know that the file is in use.<BR><BR>

Posting Permissions

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