Friday, November 13, 2009

PDF Fails to open in IE

Actually I was trying to (open/Save As) a pdf file from the IE with SSL (HTTPS) ON,using the report viewr (RDLC). Fortunately it works fine with firefox and not in IE :(. Here is the deal, remove the Cache statement from the below code you are done :).
To know more about the issue please visit this link.

1: Response.Clear();
2: Response.Buffer = true;
3: Response.ContentType = "application/pdf";
4: Response.Cache.SetCacheability(HttpCacheability.NoCache);
5: Response.AddHeader("content-disposition", "attachment;filename=test.pdf");
6: Response.Charset = "";
7: Response.BinaryWrite(pdfContent);
8: Response.End();

No comments: