PRB: Error 800a0035 When You Use the FileSystemObject Object (276011)



The information in this article applies to:

  • Microsoft Active Server Pages

This article was previously published under Q276011

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


Modification Type:MinorLast Reviewed:4/22/2003
Keywords:kberrmsg kbFSO kbprb KB276011 kbAudDeveloper