客户端从服务器系统下载文件? [英] client download file from server system?

查看:135
本文介绍了客户端从服务器系统下载文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public static void Download(string FTPFullFileName, string DestFullFileName)
  {
      try
      {

          DestFullFileName = DestFullFileName.Replace("/", "\\");
          int indexPart = DestFullFileName.LastIndexOf("\\");

          if (indexPart != -1)
          {
              String DestFolder = DestFullFileName.Substring(0, indexPart + 1);

              if (!System.IO.Directory.Exists(DestFolder))
                  Directory.CreateDirectory(DestFolder);
          }

          FtpWebRequest FTP = (FtpWebRequest)FtpWebRequest.Create(FTPFullFileName);
          FTP.Method = WebRequestMethods.Ftp.DownloadFile;
          FTP.UseBinary = true;

          FTP.Proxy = null;
      }
 }







protected void LinkButton1_Click(object sender, EventArgs e)
    {
        
        Download("D://Error.txt", @"E://Error.txt");

    }





当我点击链接按钮,然后拨打下载方式,

然后现在我得到一个例外这一行



FtpWebRequest FTP =(FtpWebRequest)FtpWebRequest.Create(FTPFullFileName);



无效的Uri异常......我们改变了什么..如何从服务器系统获取文件



when i click on link button,then call download method,
then now i get an exception this line

FtpWebRequest FTP = (FtpWebRequest)FtpWebRequest.Create(FTPFullFileName);

Invalid Uri exception..what we change..how to get the file from the server system

推荐答案

你应该提供一个有效的FTP-URL请求。
you should provide a valid FTP-URL for the request.


这篇关于客户端从服务器系统下载文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆