首页  ·  知识 ·  
Label
      编辑:  图片来源:网络

private void FileDownload(string FullFileName)

  {

  FileInfo DownloadFile = new FileInfo(FullFileName);

  Response.Clear();

  Response.ClearHeaders();

  Response.Buffer = false;

  Response.ContentType = "application/octet-stream";

  Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.UTF8));

  Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());

  Response.WriteFile(DownloadFile.FullName);

  Response.Flush();

  Response.End();

  }

  调用方法

  string path= Server.MapPath("fujian/"+文件名称);//path为服务器存放文件的路径

  FileDownload(path);

 

免费开源的asp.net购物系统  下载地址:http://www.csdnit.com/showtopic-2157.html    演示地址:http://www.56fuyuan.com/

本文作者:网友 来源: http://www.cnblogs.com/126163/
CIO之家 www.ciozj.com 微信公众号:imciow
   
免责声明:本站转载此文章旨在分享信息,不代表对其内容的完全认同。文章来源已尽可能注明,若涉及版权问题,请及时与我们联系,我们将积极配合处理。同时,我们无法对文章内容的真实性、准确性及完整性进行完全保证,对于因文章内容而产生的任何后果,本账号不承担法律责任。转载仅出于传播目的,读者应自行对内容进行核实与判断。请谨慎参考文章信息,一切责任由读者自行承担。
延伸阅读
也许感兴趣的
我们推荐的
主题最新
看看其它的
收藏至微信