View Full Version : Problem writing a text file(OpenTextFile)

07-06-2004, 03:37 AM
Hi there, I'm having a hard time to open/write to a txt file from a .asp, the code is right, but, looks that the iis 5.0 is messing with the file system.

once the execution gets to the point of :
Set filetxt = filesys.OpenTextFile(sFilePathAndName, ForReading, False)

the browser just hangs forever, If I do the request to the same .asp several times then the IIS hangs, and can not even stop the service(a bug in IIS).

I'm running w2k pro, w/IIS 5.0

Here is the code, any help is fully appreciated:

Const fsoForAppend = 8

Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

'Open the text file
Dim objTextStream
Set objTextStream = objFSO.OpenTextFile("C:\Welcome.txt", fsoForAppend)

'Display the contents of the text file
objTextStream.WriteLine "Hello, World!"
objTextStream.WriteLine "This is fun!!"

'Close the file and clean up
Set objTextStream = Nothing
Set objFSO = Nothing

07-06-2004, 10:33 AM
Does the "C:\Welcome.txt" file exist?

Try specifying true in the 3rd parameter that indicates the file should be created if it doesn't exist.

Set objTextStream = objFSO.OpenTextFile("C:\Welcome.txt", fsoForAppend, true)

07-09-2004, 11:02 PM
Hi.. having the same problem with IIS. Yes the file exists and permissions are set correctly. I've seen a couple of other posts around that might suggest it's an antivirus problem.

02-01-2005, 09:21 PM
can somebody help meeeeeeeeeeeeeeeeeeeeeeee

I deactivated the antivirus and the problem persits

02-02-2005, 05:42 AM
Problem was the script blocking software.......................

02-02-2005, 05:48 AM

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum