开发者

Download FTP using FtpWebRequest

开发者 https://www.devze.com 2023-02-26 12:52 出处:网络
I use this code to download a file by FTP: FtpWebRequest reqFTP; reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(\"ftp://\" + IPServer + \"/\"));

I use this code to download a file by FTP:

FtpWebRequest reqFTP; reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + IPServer + "/")); 
reqFTP.UseBinary = true; 
reqFTP.Credentials = new NetworkCredential(user, pass); 
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory; 
reqFTP.Proxy = null; 
reqFTP.KeepAlive = false; 
reqFTP.UsePassive = false; 
response = reqFTP.GetResponse();

But I have a problem. My credentials will make my user's home folder. I must go back to the root folder and select the specific folder to download the file. how i specified in the Uri that i need go back?

I开发者_Go百科 tried to use this /../ but is not working...

Little help?


this has nothing to do with your code ...

the ftp-server decides what's the ftp root folder.

for your credentials that seems to be that users home dir.

if you want to change that, check the ftp-server docs & config

0

精彩评论

暂无评论...
验证码 换一张
取 消