日期:2014-05-20  浏览次数:20811 次

ftp下载文件
如何从ftp服务器上的AllFile文件夹中取出文件并下载到本地的File文件夹中

------解决方案--------------------
Up
------解决方案--------------------
我也想解决阿:先来点代码
strurl = "ftp:// " + strurl;
Uri target = new Uri(strurl);
if (target.Scheme != Uri.UriSchemeFtp)
{
MessageBox.Show( "FTP服务器地址错误! " );
return;
}

FtpWebRequest request = (FtpWebRequest)WebRequest.Create(target);
request.Method = WebRequestMethods.Ftp.DownloadFile;
request.Credentials = new NetworkCredential(strusr, strpwd);

FtpWebResponse response = (FtpWebResponse)request.GetResponse();
if (response.StatusCode != FtpStatusCode.LoggedInProceed)
{
MessageBox.Show( "登陆FTP服务器失败: "+response.StatusDescription);
return;
}