PRB: Error 800a0035 When You Use the FileSystemObject Object

Veralteter Haftungsausschluss für KB-Inhalte

Dieser Artikel wurde für Produkte geschrieben, für die Microsoft keinen Support mehr anbietet. Deshalb wird dieser Artikel im vorliegenden Zustand bereitgestellt und nicht mehr aktualisiert.

Symptoms

When you use the FileSystemObject object from an Active Server Pages (ASP) page, you may receive one of the following error messages:

Server object error 'ASP 0177 : 800a0035'
Server.CreateObject Failed
filename.asp, line xx
The operation completed successfully.
-or-
Microsoft VBScript runtime (0x800A0035)
File not found
filename.asp, line xx

Cause

This error occurs because FileSystemObject cannot find the file that is being accessed (through the OpenTextFile, DeleteFile, or CopyFile methods, for example). This typically occurs for two reasons:
  • The file does not exist.
  • FileSystemObject is not looking for the file in the folder that you had expected. By default, if you do not specify a path, FileSystemObject searches the WinNT\System32 folder.

Resolution

You can work around this problem in a few different ways:

  • Verify that the file exists before you try to access it. For example:
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    If objFSO.FileExists(Server.MapPath("filename.txt")) Then
    'OK to access the file.
    Set objFile = objFSO.OpenTextFile(Server.MapPath("filename.txt"),1)
    Else
    'File not found.
    End If
  • Use a fully qualified path and file name. For example:
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("c:\inetpub\wwwroot\filename.txt",1)
  • Use the Server.MapPath method to map the virtual or relative path of the file to the full physical path of the file. For example:
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile(Server.MapPath("filename.txt"),1)

References

For additional information on the FileSystemObject object, click the article number below to view the article in the Microsoft Knowledge Base:

197964 PRB: Cannot Access Remote Files with the FileSystemObject
Eigenschaften

Artikelnummer: 276011 – Letzte Überarbeitung: 22.04.2003 – Revision: 1

Feedback