错误“从服务器接收到重复的标题”在Chrome 16 EPPlus 2.9 [英] 'Duplicate headers received from server' Error in Chrome 16 with EPPlus 2.9

查看:164
本文介绍了错误“从服务器接收到重复的标题”在Chrome 16 EPPlus 2.9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与 EPPlus 2.9 并由于某种原因,我得到<$玩弄C $ C>复制标题收到服务器错误,当我尝试下载使用Chrome 16(它工作正常,在IE9)单的.xlsx 文件。

I'm playing around with EPPlus 2.9 and for some reason I'm getting Duplicate headers received from server errors when I try to download single .xlsx files using Chrome 16 (It works fine in IE9).

我用<一个href=\"http://www.c-sharpcorner.com/uploadfile/vendettamit/web-application-export-to-excel-advanced-using-open-source-library-epplus/\"相对=nofollow>本教程,我已经缩小的问题这条线code的:

I'm using this tutorial and I've narrowed down the problem to this line of code:

        Response.AppendHeader("Content-Disposition",
        "attachment; " +
        "filename=\"ExcelReport.xlsx\"; " +
        "size=" + fileBytes.Length.ToString() + "; " +
        "creation-date=" + DateTime.Now.ToString("R") + "; " +
        "modification-date=" + DateTime.Now.ToString("R") + "; " +
        "read-date=" + DateTime.Now.ToString("R"));

我的用户代理:

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7

我在此Chrome论坛页面的浏览器不喜欢逗号()的内容处置头,他们应该被替换分号(; )。

I read on this Chrome forum page that Chrome doesn't like commas (,) in Content-Disposition headers and they should be replaced with semicolons (;).

任何人有任何意见或得到同样的错误?

Anybody got any ideas or getting the same errors?

推荐答案

我是哑巴, DateTime.Now.ToString(R)产生周四,2012年01月26 2时05分44秒GMT

我固定它通过执行此操作:

I fixed it by doing this:

String timestamp_without_commas = DateTime.Now.ToString("R").Replace(",","");

Response.AppendHeader("Content-Disposition",
    "attachment; " +
    "filename=\"ExcelReport.xlsx\"; " +
    "size=" + fileBytes.Length.ToString() + "; " +
    "creation-date=" + timestamp_without_commas + "; " +
    "modification-date=" + timestamp_without_commas + "; " +
    "read-date=" + timestamp_without_commas);

我已经习惯了IE浏览器正在胡思乱想和Chrome玩好...

I'm used to IE being cranky and Chrome playing nice...

这篇关于错误“从服务器接收到重复的标题”在Chrome 16 EPPlus 2.9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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