locked
Using absolute paths with FTP and WebClient RRS feed

  • Question

  • I want to use WebClient to access a file on an FTP server.  The FTP server logs in my user account to a initial directory that isn't part of the path to the file I need.

    WebClient is running an PWD command on login and appending that to my path, so I can never get to the absolute file.  Any way to skip the append?   My URI is ftp://192.168.0.1/vol3/files/fi000/fi001/a.cfg

    System.Net Information: 0 : [0176] FtpControlStream#48285313 - Received response [230 User user1 Logged in Successfully]
    System.Net Information: 0 : [0176] FtpControlStream#48285313 - Sending command [OPTS utf8 on]
    System.Net Information: 0 : [0176] FtpControlStream#48285313 - Received response [500 'OPTS utf8 on' : Unknown Command]
    System.Net Information: 0 : [0176] FtpControlStream#48285313 - Sending command [PWD]
    System.Net Information: 0 : [0176] FtpControlStream#48285313 - Received response [257 "/vol2" is Current Directory]
    System.Net Information: 0 : [0176] FtpControlStream#48285313 - Sending command [CWD /vol2/vol3/files/fi000/fi001/]
    System.Net Information: 0 : [0176] FtpControlStream#48285313 - Received response [550 No Such Directory "/vol2/vol3/files/fi000/fi001"]
    System.Net Information: 0 : [0176] FtpWebRequest#35191196::(Releasing FTP connection#48285313.)
    System.Net Error: 0 : [0176] Exception in the FtpWebRequest#35191196::GetResponse - The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
    System.Net Error: 0 : [0176]    at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
    Tuesday, November 4, 2008 5:57 PM

Answers

  • Sadly there's no option to turn this off, but if you prefix an extra '/' after the host it will use an absolute path. Try:

    ftp://192.168.0.1//vol3/files/fi000/fi001/a.cfg
    Tuesday, November 4, 2008 9:15 PM

All replies

  • Sadly there's no option to turn this off, but if you prefix an extra '/' after the host it will use an absolute path. Try:

    ftp://192.168.0.1//vol3/files/fi000/fi001/a.cfg
    Tuesday, November 4, 2008 9:15 PM
  • Yes, that worked.  I had seen the help article on adding the %2F to the URI string, but I was putting it in the wrong place.
    Tuesday, November 4, 2008 10:10 PM