PRB: FileSystemObject Object Causes Scripting Error

ID: Q190245


The information in this article applies to:
  • Microsoft Visual Basic, Scripting Edition, version 2.0
  • Microsoft JScript, version 2.0
  • Microsoft Internet Explorer (Programming) versions 3.0, 3.01, 3.02


SYMPTOMS

When the FileSystemObject object is instantiated by Internet Explorer 3.x with Scripting 2.0, the error message "Object not safe for scripting" appears. This warning occurs regardless of the current security setting.


CAUSE

The FileSystemObject object is not considered safe for scripting because it allows access to the hard disk.

With objects not considered safe for scripting, a safety error can be suppressed by the user setting the appropriate Internet Explorer security setting. By modifying the settings in the Internet Options dialog box, the browser can be set to prompt the user or disregard the error.

For the FileSystemObject object, Internet Explorer 3.x does not respect this security setting and will always display the error message.


RESOLUTION

This problem has been fixed in Internet Explorer 4.0.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
This bug has been corrected in Internet Explorer 4.0.


MORE INFORMATION

Steps to Reproduce Behavior

Place the following script in the BODY tag of an HTML file and navigate to it using Internet Explorer 3.x with Scripting 2.0 installed.

<SCRIPT Language="VBScript">
<!--
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set a = fs.CreateTextFile("c:\testfile.txt", True)
    a.WriteLine("This is a test.")
    a.Close
-->
</SCRIPT> 


REFERENCES

For more information, please see the MSDN Web Workshop:

http://msdn.microsoft.com/workshop/default.asp

Additional query words:

Keywords : kbJScript kbVBScript kbIEFAQ
Version : WINDOWS:2.0,3.0,3.01,3.02
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: January 27, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.