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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Location
    Hull
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Permission Denied Error Creating a File

    Hi there,

    I am having real problems with file permissions with the FileSystemObject in VBScript and need some advice.

    This is the code I am using:

    Dim Data
    Data = "c:\Data.css"
    Set FileToWrite = Server.CreateObject("Scripting.FileSystemObject")

    If FileToWrite.FileExists(Data) Then
    FileToWrite.DeleteFile Data, True
    Set StyleWrite = FileToWrite.CreateTextFile(Data)
    Else
    Set FileToWrite = FileToWrite.CreateTextFile(Data)**
    End If

    At present the file Data.css exists. If it doesn't exist I want to create a new one and if not I want to delete the file and recreate it. I have set all permissions I can think of for the Internet and Web guest accounts on the C drive, but it will not allow it to be deleted and gives a permissions denied error.
    If the code to delete the file is commented out and you allow the file to be overwritten instead by changing the creation file code to:

    Set FileToWrite = FileToWrite.CreateTextFile(Data, True)

    This gives the same permission denied error

    The asp page I am running with this code is running off my localhost and is being debugged in VS.NET.
    Any suggestions on what might be wrong and what settings to re-check.
    Last edited by masj78; 05-04-2006 at 04:40 PM. Reason: wrong title and typos in main text

  • #2
    New Coder
    Join Date
    May 2006
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't know if this will help, but I found it in a forum. It was posted by a user who was also receiving a permission denied error when trying to use .DeleteFile()

    if you're running Norton Antivirus, there's a section called "script blocking" which blocks out dangerous script, and since the file system object is logging onto my pc to get information Norton see's it as a problem and blocks access. so i turned that one fuction off and file system object works fine.


  •  

    Posting Permissions

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