Solved

ASP.Net write PDF to browser shows garbage in IE

Posted on 2014-01-31
1
390 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

by:
XGIS earned 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 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