簡體   English   中英

Response.AddHeader在IE中不起作用

[英]Response.AddHeader not working in IE

我在使用Response.AddHeader時遇到問題。 Firefox和Chrome可以正常工作(它們顯示彈出窗口並下載文件),但在IE中則不能,在IE中,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";

以及我在互聯網上可以找到的更多信息。

好吧..當我嘗試一天並弄清楚這個問題時,這個問題就解決了。

簡單,即不允許在彈出頁面中使用“ Response.AddHeader”(我嘗試使用ie8-10)。 我不知道為什么,但是在crome和ff上工作。

如果知道為什么這樣的行為,我會感激..

謝謝,

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM