Click to See Complete Forum and Search --> : Problem in uplod File through FTP


priteshpatel
August 25th, 2007, 12:05 AM
I am working on windows application with c#.net .
I am using FTPwebreuqest class for upload file on ftp.it works fine when there is no proxy between application and internet. but it doesn't work in proxy.

FtpWebRequest reqFTP;
if i use reqFTP.Proxy=new webproxy("proxyservername",21);
then it will display error message "FTP command doen't support in HTTP proxy".

my code is like this




FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create("ftp://uri");

reqFTP.Credentials = new NetworkCredential("username", "pwd");

reqFTP.KeepAlive = false;

reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.UsePassive = true;
int buffLength = 2048;

byte[] buff = new byte[buffLength];
int contentLen;

FileStream fs = fileInf.OpenRead();

Stream strm = reqFTP.GetRequestStream();

contentLen = fs.Read(buff, 0, buffLength);

while (contentLen != 0)
{
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
prbUpload.Value += contentLen;
}

strm.Close();
fs.Close();


Any one help me about proxy settings in FTPwebrequest

Thread1
August 25th, 2007, 03:36 AM
does your HTTP proxy server support the FTP protocol?

you can check it with your internet browser by navigating the address with - ftp://

priteshpatel
August 29th, 2007, 01:14 AM
MY http proxy doesn't support FTP protocol
How to do that?

Other software of FTP working properly in within proxy.

Is there any other way to solve?
Because when i deploy my application on client machine and it's http proxy might not support FTP and if other FTP software properly working on that machine then it will be problem for me.


Is there any other way to remove this dependences?

Thread1
August 30th, 2007, 06:11 AM
unfortunately, the current FtpWebRequest does not support file upload operation for HTTP proxy. you may try to look for other FTP client class out there that has sufficient support for certain proxies, but i am afraid it may cost you.