如何从服务器文件夹下载文件? [英] how to download file from server folder ?

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

问题描述

protected void LinkButton1_Click(object sender, EventArgs e)
  {
      string url = @"D://Error.txt";
      // Create an instance of WebClient
      WebClient client = new WebClient();
      // Hookup DownloadFileCompleted Event
      client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);

      // Start the download and copy the file to c:\temp
      client.DownloadFileAsync(new Uri(url), @"E:\Error.txt");
  }
  void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
  {
      Response.Write("File downloaded");
  }







这里@D://Error.txt;来自服务器系统指令的路径名...我想从服务器系统下载文件..但我没有从这段代码得到任何结果...请帮助我?




Here @"D://Error.txt"; path name from the server system directive...I want to down load a file from server system..but i am not getting any result from this code...please help me?

推荐答案

在哪里下载?您正尝试将一个本地文件复制到另一个本地文件。无需使用 WebClient ,只需复制该文件即可。 :-)



-SA
Where is downloading? You are trying to copy one local file to another. No need to use the WebClient for that, just copy the file. :-)

—SA


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

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