Article ID: 201133
Article Last Modified on 11/21/2006
<%
Set fs = server.CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile("c:\inetpub\wwwroot\testfile.txt", 1, FALSE, TRUE )
do while not a.AtEndOfStream
response.write(a.readline&"<br>"&Chr(13))
loop
a.Close
%>
However, with IIS 4.0, it displays random characters depending on the contents of Testile.txt. For example, if Testfile.txt contains the following:
this is testfile.txt line 2 line 3The response returned to a browser is:
???????????????????
object.OpenTextFile(filename[, iomode[, create[, format]]])
object = Required. Always the name of a FileSystemObject.
filename = Required. String expression that identifies the file to open.
iomode = Optional. Indicates input/output mode. Can be one of two constants, either
ForReading or ForAppending.
create = Optional. Boolean value that indicates whether a new file can be created if
the specified filename doesn't exist. The value is True if a new file is
created; False if it isn't created. The default is False.
format = Optional. One of three Tristate values used to indicate the format of the
opened file. If omitted, the file is opened as ASCII.
The parameters listed above may have these settings. The iomode argument can have either of the following:
1 = ForReading. Open a file for reading only. You can't write to this file. 8 = ForAppending. Open a file and write to the end of the file.The format argument can have any of the following:
-2 = TristateUseDefault. Opens the file using the system default.
-1 = TristateTrue. Opens the file as Unicode.
0 = TristateFalse. Opens the file as ASCII.
Keywords: kbinfo KB201133