Link to home
Start Free TrialLog in
Avatar of Samm1502
Samm1502

asked on

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
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

>"C:\ myTemp\DJ0000001P.html"
        ^

Is there a space there, or is that a typo?
Avatar of Samm1502
Samm1502

ASKER

Oh its just a typo sorry!
ASKER CERTIFIED SOLUTION
Avatar of cb1393
cb1393
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
(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
did you check permissions on the directory where you are trying to create a file..? IUSR_<machinename>
grant FULL CONTROL to IUSR_<machine name> user. You will be able to create file.

N
don't grant full, grant "read & write", "read" and "write"
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