Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.Net write PDF to browser shows garbage in IE

Posted on 2014-01-31
1
Medium Priority
?
403 Views
Last Modified: 2014-02-05
Hi.. I have the following code that writes and shows a PDF file in a brower.
Works great in Chrome.. In IE I get a bunch of garbage characters.

Like this

%PDF-1.6 %ÓôÌá 1 0 obj..........

Any ideas
thx


                Response.Clear();
                Response.ContentType = res.MimeType;

                Response.Cache.SetCacheability(HttpCacheability.Private);
                Response.Expires = -1;
                Response.Buffer = false;

                this.Response.BinaryWrite(res.DocumentBytes);
                this.Response.End();
0
Comment
Question by:JElster
1 Comment
 
LVL 7

Accepted Solution

by:
XGIS earned 2000 total points
ID: 39824639
Hello Jelster..
maybe it is due to the bug related to nocache headers.  this code may help
Response.Expires = -1
    Response.Cache.SetNoStore()
    Response.AppendHeader("Pragma", "no-cache")
    Response.ContentType = "application/pdf"
    Response.BinaryWrite(myByteBuffer)
    Response.Flush()
    Response.Close()

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Loops Section Overview
Suggested Courses
Course of the Month11 days, 12 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question