我有一個aspx頁面,其中包含一個顯示pdf的iframe頁面(我在iframe中顯示pdf時使用了ashx處理程序),我也有一個下載按鈕,它將不同的pdf作爲附件。 下載到瀏覽器的代碼(這是ashx的處理程序)IE中的iframe變空白
byte[] bytes = // get byte array from table
Response.Buffer = false;
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
// [optional]
Response.AddHeader(
"Content-Disposition",
string.Format("attachment; filename={0}", attachmentName)
);
Response.OutputStream.Write(bytes, 0, bytes.Length);
Response.End();
此代碼然而,發送此響應瀏覽器我的iframe中一片空白,我必須刷新頁面才能再次見到它後工作正常。我想大部分的解決方案
但他們沒有工作。 iframe在chrome & FF中表現良好。 注意:如果我下載的東西使用asp:超鏈接到我的ashx和設置目標=「_ blank」它在IE中工作正常,但我需要一些服務器端處理來做,因此我不能使用這種方法。
您使用的是什麼版本的IE?你嘗試過哪些版本? – Xcalibur37 2011-12-21 01:34:40
我使用IE9 n我試過IE 7,8。 – DotNetUser 2011-12-21 03:17:10