We use the below code to show PDF files using Response.BinaryWrite. We are exploring new options as to optimize the user performance.
Response.Clear();
Response.ContentType = "application/pdf";
if (Page.Request!=null && Page.Request.Browser!=null &&
(!(Page.Request.Browser.Type.Contains("IE") || Page.Request.Browser.Type.Contains("InternetExplorer"))))
{
Response.AddHeader("Content-Length", buffer.Length.ToString());
}
Response.AddHeader("Content-Encoding", "deflate");
if (Request.Browser.Browser == "IE" && Request.Browser.MajorVersion < 7)
Response.AddHeader("Content-Disposition", "attachment; filename=document.pdf");
Response.OutputStream.Write(buffer, 0, buffer.Length);//Response.BinaryWrite(buffer);
Response.End();
Response.Flush();
Response.Close();
I read that Response.outputstream.write is another option to render the PDF. Using Response.outputstream.write will have any added advantage ?