失败 - EPPlus.dll下载excel文件时出现网络错误 [英] Failed - network error when downloading excel file made by EPPlus.dll

查看:175
本文介绍了失败 - EPPlus.dll下载excel文件时出现网络错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从asp.net c#web表单应用程序下载由 EPPlus.dll 制作的excel文件。但我收到失败 - 网络错误。
应该注意的是,提到的错误只发生在chrome中,并且可以在其他浏览器中成功完成该任务。

I try to download an excel file made by EPPlus.dll from an asp.net c# web form application. but i get Failed - network error. It should be noted that mentioned error just occurs in chrome and the job can be done successfully in another browsers.

通过这种错误不会发生我的本地主机只发生在主服务器上。

by the way this error does not occure on my localhost and it happens only on the main server.

如果有人可以解释这个问题的解决方案,这将是非常有帮助的。

It would be very helpful if someone could explain solution for this problem.

http://www.irandnn.ir/blog/PostId/29 / epplus

推荐答案

尝试这样:

using (ExcelPackage p = new ExcelPackage())
{
    //Code to fill Excel file with data.


    Byte[] bin = p.GetAsByteArray();

    Response.ClearHeaders();
    Response.ClearContent();
    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
    Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", Nombre_Del_Libro + ".xlsx"));
    Response.BinaryWrite(bin);
    Response.Flush();
    Response.End();
}   

这篇关于失败 - EPPlus.dll下载excel文件时出现网络错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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