IIS file permissions question

Discussion in 'Microsoft Development' started by antic, Jul 16, 2011.

  1. antic

    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:
        Set sf = Server.CreateObject("ADODB.Stream")
        sf.Type = 2 ' Text file
        sf.WriteText "some text", 0
        sf.SaveToFile sUploadPath & "stream.txt", 2 ' This works ok and creates the file.
        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?

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services