Article ID: 201133 - Last Review: July 7, 2008 - Revision: 4.1 Scripting Change Occurs When Upgrading from IIS 3.0
This article was previously published under Q201133 We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 7.0 running on Microsoft Windows Server 2008. IIS 7.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site: http://www.microsoft.com/technet/security/prodtech/IIS.mspx
(http://www.microsoft.com/technet/security/prodtech/IIS.mspx)
For more information about IIS 7.0, visit the following Microsoft Web site: http://www.iis.net/default.aspx?tabid=1
(http://www.iis.net/default.aspx?tabid=1)
SYMPTOMS
Using Scripting.FileSystemObject may return random characters due to a change in the IIS 3.0 implementation of the OpenTextFile method.
With IIS 3.0, the following script correctly displays the contents of Testfile.txt: this is testfile.txt line 2 line 3 ??????????????????? CAUSE
The error is caused by the last parameter to OpenTextFile. It is the "format" used to open the file, ASCII, Unicode, and so on. In IIS 3.0, this parameter is ignored. In IIS 4.0, VBScript respects the parameter.
The OpenTextFile method has these parameters: where the following applies:
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.
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.
-2 = TristateUseDefault. Opens the file using the system default.
-1 = TristateTrue. Opens the file as Unicode.
0 = TristateFalse. Opens the file as ASCII.
MORE INFORMATION
More information on this can be found in the Windows NT Option Pack online documentation.
If you installed the product documentation, this is located at the following local URL:
http://localhost/iisHelp/iis/misc/default.asp (http://localhost/iisHelp/iis/misc/default.asp)
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations |






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
