Generating PDF, error with IE and HTTPS

前端 未结 12 541
醉酒成梦
醉酒成梦 2020-12-08 09:17

I am streaming a PDF to the browser in ASP.NET 2.0. This works in all browsers over HTTP and all browsers except IE over HTTPS. As far as I know, this used to work (o

12条回答
  •  Happy的楠姐
    2020-12-08 09:25

    Adding it here hoping that someone might find this useful instead going through the links.

    Here is my code

        byte[] bytes = // get byte array from DB
    
        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.Buffer = true;
    
        // Prevent this page from being cached.
        //  NOTE: we cannot use the CacheControl property, or set the PRAGMA header value due to a flaw re: PDF/SSL/IE
        Response.Expires = -1; 
    
        Response.ContentType = "application/pdf";
        // Specify the number of bytes to be sent
        Response.AppendHeader("content-length", bytes.Length.ToString());
    
        Response.BinaryWrite(bytes);    
    
                // Wrap Up
        Response.Flush();
        Response.Close();
        Response.End();
    

提交回复
热议问题