Solved

FTP Client with FtpWebRequest

Posted on 2010-08-18
5
1,001 Views
Last Modified: 2013-12-17
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
//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;

Open in new window

0
Comment
Question by:andre72
  • 2
  • 2
5 Comments
 
LVL 27

Accepted Solution

by:
nmarun earned 250 total points
ID: 33463365
0
 
LVL 14

Assisted Solution

by:Dhanasekaran Sengodan
Dhanasekaran Sengodan earned 250 total points
ID: 33463901
0
 

Author Comment

by:andre72
ID: 33463904
Thanks, this is very simular to my function and this worked fine before there was a proxy installed.
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?
0
 
LVL 14

Expert Comment

by:Dhanasekaran Sengodan
ID: 33464244
i have a query, r u upload something in server?
0
 

Author Comment

by:andre72
ID: 33464958
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
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now