\\server\file.ext does not like objFSO.FileExists()

Discussion in 'ASP General' started by Bob, Apr 26, 2005.

  1. Bob

    Bob Guest

    When a file is local to the ASP application, I can use the following code to
    test if the file exists:

    Dim strFileName, blnFileExists, objFSO

    strFileName = Server.MapPath( "\MyFiles\test.doc" )

    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    blnFileExists = objFSO.FileExists( strFileName )
    Set objFSO = Nothing

    But if "MyFiles" resides on another server and I set up a virtual directory
    in my ASP app to reference to it (e.g. "\MyFiles\test.doc" resolves to
    \\server2\F$\MyFiles\test.doc), the code would return False even if the file
    exists on the other server.

    Is there a way to test the existence of a file that resides on another
    server?
    Bob, Apr 26, 2005
    #1
    1. Advertising

  2. The user attempting to access the file needs to have permissions to get to
    it. Under a normal setup MACHINE\IUSER_MACHINE doesn't rights to
    \\OTHERMACHINE\Sharename, because OTHERMACHINE does not know who
    MACHINE\IUSR_MACHINE is.

    http://www.aspfaq.com/show.asp?id=2168

    Ray at work

    "Bob" <> wrote in message
    news:...
    > When a file is local to the ASP application, I can use the following code

    to
    > test if the file exists:
    >
    > Dim strFileName, blnFileExists, objFSO
    >
    > strFileName = Server.MapPath( "\MyFiles\test.doc" )
    >
    > Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    > blnFileExists = objFSO.FileExists( strFileName )
    > Set objFSO = Nothing
    >
    > But if "MyFiles" resides on another server and I set up a virtual

    directory
    > in my ASP app to reference to it (e.g. "\MyFiles\test.doc" resolves to
    > \\server2\F$\MyFiles\test.doc), the code would return False even if the

    file
    > exists on the other server.
    >
    > Is there a way to test the existence of a file that resides on another
    > server?
    >
    >
    Ray Costanzo [MVP], Apr 26, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jindal, Pankaj

    ['ext.IsDOMString', 'ext.SplitQName']

    Jindal, Pankaj, Dec 22, 2004, in forum: Python
    Replies:
    0
    Views:
    314
    Jindal, Pankaj
    Dec 22, 2004
  2. Replies:
    11
    Views:
    599
  3. Jeff Uchtman

    another objFSO question.

    Jeff Uchtman, Oct 20, 2003, in forum: ASP General
    Replies:
    3
    Views:
    124
    Ken Schaefer
    Oct 20, 2003
  4. Rudi Ahlers

    objFSO.FileExists not working?????

    Rudi Ahlers, Apr 10, 2004, in forum: ASP General
    Replies:
    15
    Views:
    751
    Lord Merlin
    Apr 13, 2004
  5. Joe

    FileExists on a Different Server

    Joe, Jan 14, 2009, in forum: ASP General
    Replies:
    2
    Views:
    379
Loading...

Share This Page