无为清净楼资源网 Design By www.qnjia.com

1、说明

  通过文件下载框实现将服务器上的文件下载到本地指定位置。这里需要指定服务器文件路径

//服务器文件路径
string strFilePath = Server.MapPath("~") + "/excel/20170206104654.xlsx";
FileInfo fileInfo = new FileInfo(strFilePath);
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(fileInfo.Name.ToString()));
Response.AddHeader("content-length", fileInfo.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.Default;
Response.WriteFile(strFilePath);

asp.net实现服务器文件下载到本地的方法

asp.net实现服务器文件下载到本地的方法

以上所述是小编给大家介绍的asp.net实现服务器文件下载到本地的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!

标签:
asp.net服务器文件下载,asp.net服务器

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com