FTP through FTP proxy

I am trying to download a file using FTP through a FTP proxy (on my side). This is script I am trying to implement in C#:

On Commandline:
ftp -i -s:get.ini
-----------get.ini------------ abc/user_name
cd pub/linux/knoppix
get packages.txt
abc/user_name is my user name who was granted by permissions to FTP through my corporate proxy.

I want to implement above script in C#, but after playing with many types of code found on Internet I cannot do that.

FtpWebRequest request = FtpWebRequest.Create(new Uri(@ftp:// + + @/ + Path.GetFileName(fileToUpload))) as FtpWebRequest;
request.UseBinary = true;
request.KeepAlive = false;
request.Method = WebRequestMethods.Ftp.UploadFile;
if (!string.IsNullOrEmpty(CORPORATE_PROXY_USER) && !string.IsNullOrEmpty(CORPORATE_PROXY_PASSWORD ))
request.Credentials = new NetworkCredential(CORPORATE_PROXY_USER, CORPORATE_PROXY_PASSWORD );

//Get physical file
FileInfo fi = new FileInfo(fileToUpload);
Byte[] contents = new Byte[fi.Length];

//Read file
FileStream fs = fi.OpenRead();
fs.Read(contents, 0, Convert.ToInt32(fi.Length));

request.Proxy = new WebProxy("");
request.Proxy.Credentials = new NetworkCredential(abc/user_name, user_name_password);

//Write file contents to FTP server
Stream rs = request.GetRequestStream();
rs.Write(contents, 0, Convert.ToInt32(fi.Length));

FtpWebResponse response = request.GetResponse() as FtpWebResponse;
string statusDescription = response.StatusDescription;
return statusDescription;
The main problem is that for the proxy I am using WebProxy, while I suspect I should use FTPProxy - which I cannot find anythere? Any ideas which direction should I go, or maybe WebProxy is fine?
Sign In or Register to comment.
CyberHosting CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!