我以前写的你可以参考下..string FileName = "你要下载的服务器的文件名";
string destFileName = "你要保存的路径";
if( System.IO.File.Exists(destFileName ))
{
System.IO.FileInfo fi = new System.IO.FileInfo(destFileName);
Response.Clear();
Response.ClearHeaders();
Response.Charset = "utf-8";
Response.Buffer = true;

Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AppendHeader("Content-Disposition","attachment;filename=" +Server.UrlEncode( System.IO.Path.GetFileName( FileName )));
Response.AppendHeader("Content-Length",fi.Length.ToString());
Response.ContentType="application/octet-stream";
Response.WriteFile(destFileName);
Response.Flush();
Response.Close();
Response.End();
   }

解决方案 »

  1.   

    下载到客户端指定目录下,除非你用com 或 applet等,纯粹的b/s无法实现
      

  2.   

    string imgurl="http://zi.csdn.net/2007.06/MSxinjishu300X60.gif";
    string path = "D:\MYDOWNS";
    if(!Directory.Exists(path))
    Directory.CreateDirectory(path);
    path = path + @"\";//保存路径
    // Download the image
    WebClient client = new WebClient();
    // Download the data to a file.
    client.DownloadFile(imgurl, path+@"MSxinjishu300X60.gif");
    Console.WriteLine("Download URL="+imgurl);
    client.Dispose();
      

  3.   

    WebClient 引用什么库阿??
      

  4.   

    下载到客户端指定目录下,除非你用com 或 applet等,纯粹的b/s无法实现
    ----------------------------------------------------
    真的吗?