您的位置:首页 > 其它

简单下载

2020-04-02 08:03 253 查看

简单下载,项目有需要,就搞了个下载

FileInfo fi= new FileInfo(路径);
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.Charset = Encoding.UTF8.BodyName;
Response.AppendHeader("Content-Disposition", "attachment;filename=" +名称 + ".xls");
Response.AddHeader("Content-Length", fi.Length.ToString());
Response.ContentEncoding = Encoding.UTF8;
Response.ContentType = "application/vnd.ms-excel; charset=UTF-8";
Response.WriteFile(fi.FullName);
Response.Flush();
Response.End();
  • 点赞
  • 收藏
  • 分享
  • 文章举报
漫漫长路,慢慢走 发布了12 篇原创文章 · 获赞 2 · 访问量 225 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: