c# - How to download file from FTP -
i want download ftp server, not sure how it. read many threads online none of them seems working me.
i know that
"client.downloadfile("http://www.dajialol.com/box/league of legends.exe", @"c:\users\macbook\desktop\league of legends.exe");"
will download not in ftp. im not sure how download ftp.
i know have put in ftp username , password, etc.
private void btnzoom_click(object sender, eventargs e) { webclient client = new webclient (); client.downloadfile("http://www.dajialol.com/box/league of legends.exe", @"c:\users\macbook\desktop\league of legends.exe"); }
it looks examples on the documentation ftpwebrequest make use of webclient:
webclient request = new webclient(); request.credentials = new networkcredential("anonymous", "janedoe@contoso.com"); byte[] newfiledata = request.downloaddata(serveruri.tostring()); the main thing note serveruri.scheme uri.urischemeftp, seems webclient can make ftp:// requests.
another alternative i've used in past ease-of-use somebody's ftpclient class on github:
var client = new ftp("ftp://hostname.com", "username", "password"); client.downloadfile("remotefile.txt", "localfile.txt");
Comments
Post a Comment