IIS file permissions question

antic

Perch
In a classic ASP site I'm managing, files are uploaded to the server using the commonly-used FreeASPUpload script. Uploading works perfectly. But when it comes to deleting files (using FileSystemObject's Delete method) it fails with a "Permission Denied" ASP error. IIS has the correct permissions on the folder.

FreeASPUpload uses the ADO Stream object to create the file (copying data from the Request stream to the file stream). I've done a test and it seems that when a file is created with ADO Stream, it can't be deleted afterwards. For example:
Code:
    Set sf = Server.CreateObject("ADODB.Stream")
    sf.Type = 2 ' Text file
    sf.Open
    sf.WriteText "some text", 0
    sf.SaveToFile sUploadPath & "stream.txt", 2 ' This works ok and creates the file.
    sf.close
    Set sf = Nothing
    FSO.DeleteFile(sUploadPath & "stream.txt") ' This results in "Permission Denied"

I should add that I can create a file with FSO.CreateTextFile in the same folder and I *can* delete that. So it's not like IIS doesn't have delete permission. I can delete other files. I can just can't delete files created by ADO.Stream. Much weirdness! Any ideas?
 
Back
Top