• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 296
  • Last Modified:

Problem creating file with FileSysteObject

Hi there

I am trying to creat a file using the FileSystemObject from my ASP page.

I can create the object itself without a problem like this
Set objFileSys = Server.CreateObject("Scripting.FileSystemObject")                  

but but when I call the CreateTextFile method as follows:

strPath = "C:\ myTemp\DJ0000001P.html"
      
Set objFile = objFileSys.CreateTextFile(strPath, True)

The application just hangs and does nothing.  Does anyone know why this is.  The directory definitely already exists
I can only assume this is some kind of permissions problem.

Does anyone know how I can reolve it?

Many thanks
Sam
0
Samm1502
Asked:
Samm1502
  • 2
  • 2
  • 2
  • +2
1 Solution
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>"C:\ myTemp\DJ0000001P.html"
        ^

Is there a space there, or is that a typo?
0
 
Samm1502Author Commented:
Oh its just a typo sorry!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
(Wild guess)  You may not be able to use .CreateTextFile to create an .html file, so you might have to create this as an .txt, then rename it with an .html extension.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/jsmthcreatetextfile.asp
0
 
davidlars99Commented:
did you check permissions on the directory where you are trying to create a file..? IUSR_<machinename>
0
 
NaliniPCommented:
grant FULL CONTROL to IUSR_<machine name> user. You will be able to create file.

N
0
 
davidlars99Commented:
don't grant full, grant "read & write", "read" and "write"
0
 
Samm1502Author Commented:
Thanks for all your input, I tried each possible resolution in turn and it was my anti-virus script blocker that was the cause of the problem.

The problem I now face is that the company running the application will most certainly require anti-vrus software of this kind running on the IIS machine so how do I get around this as turning the blocker off will be insecure?

The link given above didn't display but will try and do a serach for it.

Many thanks all

Sam
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now