无法在 IE 6、7、8 中从 HTTPS 下载 PDF
Can't Download PDF from HTTPS in IE 6,7,8
mpp.myPDF(Response.OutputStream); // PdfDocument...
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename);
【HTTP】
IE、Firefox、Chrome:一切正常
【HTTPS】
IE 9,10,11:好的
火狐:好的
Chrome :好的
但是在
IE 6,7,8 = X......显示错误
Internet Explorer was not able to open this Internet site, the
requested site is either unavailable or cannot be found.
protected void OnPrintClick(object sender, EventArgs e)
{
if ((Request.Browser.Browser == "IE") && (Request.Browser.MajorVersion < 9))
{
Response.ExpiresAbsolute = DateTime.Now;
Response.Expires = -1441;
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("Pragma", "no-store");
Response.AddHeader("cache-control", "no-cache");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoServerCaching();
Response.Clear();
Response.Expires = 0;
Response.Buffer = true;
Response.HeaderEncoding = System.Text.Encoding.Default;
}
//↑
// I try to add these code are invalid....【Https】 IE 6、7、8.... X
mpp.myPDF(Response.OutputStream); // PdfDocument...
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename);
}
我们如何解决这个问题?
考虑将 ContentType
设置为 "application/pdf"
并在尝试流式传输到 client/browser 之前清除所有内容:
Response.Buffer = false;
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename");
mpp.myPDF(Response.OutputStream); // PdfDocument...
//could also consider:
//Response.TransmitFile("path to document");
//Response.BinaryWrite((byte[]) stream);
Response.End()
mpp.myPDF(Response.OutputStream); // PdfDocument...
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename);
【HTTP】
IE、Firefox、Chrome:一切正常
【HTTPS】
IE 9,10,11:好的
火狐:好的
Chrome :好的
但是在
IE 6,7,8 = X......显示错误
Internet Explorer was not able to open this Internet site, the requested site is either unavailable or cannot be found.
protected void OnPrintClick(object sender, EventArgs e)
{
if ((Request.Browser.Browser == "IE") && (Request.Browser.MajorVersion < 9))
{
Response.ExpiresAbsolute = DateTime.Now;
Response.Expires = -1441;
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("Pragma", "no-store");
Response.AddHeader("cache-control", "no-cache");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoServerCaching();
Response.Clear();
Response.Expires = 0;
Response.Buffer = true;
Response.HeaderEncoding = System.Text.Encoding.Default;
}
//↑
// I try to add these code are invalid....【Https】 IE 6、7、8.... X
mpp.myPDF(Response.OutputStream); // PdfDocument...
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename);
}
我们如何解决这个问题?
考虑将 ContentType
设置为 "application/pdf"
并在尝试流式传输到 client/browser 之前清除所有内容:
Response.Buffer = false;
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename");
mpp.myPDF(Response.OutputStream); // PdfDocument...
//could also consider:
//Response.TransmitFile("path to document");
//Response.BinaryWrite((byte[]) stream);
Response.End()