当我使用Response.AddHeader时,我有一个问题。Firefox和Chrome运行得很好(它们显示弹出窗口并下载文件),但在IE中就不行了,它只打开一个空白弹出窗口,不会做任何事情,比如下载文件或显示提示。弹出窗口的标题是"-- webpage dialog“。
我的代码如下:
byte[] bRpt = ExportReportYoStream(rptMain, ExportFormatType.Excel);
Response.ClearHeaders();
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=Test Document.xls");
Response.BinaryWrite(bRpt);
Response.Flush();
Response.End();我还尝试了许多更改,例如:
Response.ContentType = "application/Save";
Response.ContentType = "application/octet-stream";还有更多我能在网上找到的。
发布于 2013-05-27 00:41:20
好的..。这个问题在我尝试了一天并弄清楚之后就解决了。
很简单,即不允许在弹出页面中使用"Response.AddHeader“(我尝试过ie8-10)。我不知道为什么,但在crome和ff上工作。
如果有人知道为什么会有那样的行为,我很感激..
谢谢,
https://stackoverflow.com/questions/16726708
复制相似问题