andre72
asked on
FTP Client with FtpWebRequest
Hi,
I have a small command tool we use to get some data from a FTP server.
The matter is that the network is now after a proxy server and to connect to the FTP server the proxy mode is USER@HOST.
I found some samples to connect with this using a socket but no sample how to connect to using FtpWebRequest.
As I don't change the whole class I would prefer this way to connect ...
Is there a way how to do?
Thanks
Andre
I have a small command tool we use to get some data from a FTP server.
The matter is that the network is now after a proxy server and to connect to the FTP server the proxy mode is USER@HOST.
I found some samples to connect with this using a socket but no sample how to connect to using FtpWebRequest.
As I don't change the whole class I would prefer this way to connect ...
Is there a way how to do?
Thanks
Andre
//create request
FtpWebRequest result = (FtpWebRequest)FtpWebRequest.Create(URI);
//Set the login details
result.Credentials = Credentials;//GetCredentials();
//Do not keep alive (stateless mode)
result.KeepAlive = true;
// Set Proxy if need for
IWebProxy wp=null;
if (!String.IsNullOrEmpty(Proxy))
{
if (String.IsNullOrEmpty(Port))
wp = new WebProxy(Proxy);
else
wp = new WebProxy(Proxy,int.Parse(Port));
if (!String.IsNullOrEmpty(ProxyUsername))
wp.Credentials = ProxyCredentials;
}
result.Proxy = wp;
result.UsePassive = true;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
i have a query, r u upload something in server?
ASKER
No uploads, just DL.
I figured out that WebClient request = new WebClient(); seems to work with the proxy settings so it works fine now. Thanks
I figured out that WebClient request = new WebClient(); seems to work with the proxy settings so it works fine now. Thanks
ASKER
Now I can access using FF like ftp://user:pw@domain/file but what ever I try now from my client it can't connect.
Is there a way to trace FTP like fiddler for HTTP?