Search code examples
fiddlerftpwebrequest

WebClient FTP / 502 Error


I'm recieving a 502 error, from what should be a simple request..

WebClient webClient = new WebClient();
SourceURL = string.Format(@"ftp://{0}/{1}", "ftp.cmegroup.com", "settle/nymex_option.csv"); //used field names ... but these are the values
webclient.Credentials = new NetworkCredential(@"anonymous", @"anonymous@anonymous.com");
webClient.DownloadFile(new Uri(SourceURL), "c:\temp\temp.dat");

I captured the outgoing request via fiddler, which looks like this in the RAW inspector:

GET ftp://anonymous:anonymous%40anonymous.com@ftp.cmegroup.com/settle/nymex_option.csv HTTP/1.1
Host: ftp.cmegroup.com
Proxy-Connection: Keep-Alive

Looking for ideas as to where to start on finding out what is going on....


Solution

  • Where you have the %40 in your GET it should be a :

    ftp://anonymous:anonymous:anonymous.com@ftp.cmegroup.com/settle/nymex_option.csv

    OR

    ftp://anonymous:anonymous.com@ftp.cmegroup.com/settle/nymex_option.csv