I am trying to automate some upload / download tasks from an ftp server. When I connect to the server through the client or through Firefox even to get to my directory, I must specify this path:
ftp:
If I try to access this:
ftp:
The server gives an error message that the directory does not exist. So the problem is:
I am trying to create an FTPWebRequest with the first ftp address, but it always parses the "/../" part, and then my server says that the path does not exist.
I tried these:
Uri target = new Uri("ftp://ftpserver.com/../AB00000/incoming/files"); FtpWebRequest request = (FtpWebRequest)WebReqeuest.Create(target);
and
string target = "ftp://ftpserver.com/../AB00000/incoming/files"; FtpWebRequest request = (FtpWebRequest)WebRequest.Create(target);
In the first bit, the path is already invalid when an instance of the Uri object is created in the second bit after the WebRequest.Create method. Any ideas what is going on?
EDIT:
Also, since I posted this, I tried to create a URI with the no parse option. I also tried something like this:
string ftpserver = "ftp://ftpserver.com/../"; string path = "12345/01/01/file.toupload"; Uri = new Uri(ftpserver, path, true);
And he always parses the root part ("/../").
scottm
source share