1

I have a problem when I use Response.AddHeader. Firefox and Chrome work fine (They show the popup and download the file), but not in IE, where it only opens a blank popup and not do anything like download a file or show a prompt. The popup title is "-- webpage dialog".

My code is below:

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();

I have also tried many changes like:

Response.ContentType = "application/Save";
Response.ContentType = "application/octet-stream";

and many more as I can find on the internet.

4

1 回答 1

0

好的..当我尝试了一天并弄清楚时,这个问题就解决了。

很简单,即不允许在弹出页面中使用“Response.AddHeader”(我试过 ie8-10)。我不知道为什么,但适用于 crome 和 ff。

如果有人知道为什么这样的行为,我很感激..

谢谢,

于 2013-05-26T16:41:19.987 回答