Permissions error on FSO DeleteFile/MoveFile

10,941

IIS_USRS folder permissions had to specifically include 'Delete' from the 'Advanced' dialog in Windows.

Share:
10,941
greener
Author by

greener

Updated on June 04, 2022

Comments

  • greener
    greener almost 2 years

    I'm trying to delete/move a file using classic asp fso but I'm getting this error:

    Microsoft VBScript runtime error '800a0046'
    
    Permission denied
    

    The file is located in c:\files\test\file.txt and ultimately I want to move it to c:\archive\file.txt

    I started out with Move but I got the error. Then I split it up into Copy and Delete. The copying went fine but still the same error on Delete.

    I ruled out the Delete method because I was able to use Delete on the file in the 'archive' folder using this code:

    dim fs,f
    set fs=Server.CreateObject("Scripting.FileSystemObject")
    set f=fs.GetFile("C:\archive\file.txt")
    f.Delete
    set f=nothing
    set fs=nothing
    

    I also double-checked the permissions on both folders and they're exactly the same for IIS_IUSRS: Read&Execute, List folder contents, Read, Write are checked. I tried giving Modify rights as well but that made no difference.

    Finally, I checked the file's attributes and it came back as 32 (Archive). I also tried to force the delete:

    fso.DeleteFile FileName, true