Solved

Error opening pdf file using ie6 but it works in ie7

Posted on 2009-04-14
4
506 Views
Last Modified: 2013-11-07
Hi

I have a link the shows a pdf file. It works fine in ie7 and ff but not in ie6. I can only get it to work in ie6 if i save the file first then open.

Any help would be appreciated (Code below)
Response.ClearContent();

            Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", file.Name));

            Response.AddHeader("Content-Length", file.Length.ToString());

            Response.ContentType = "application/pdf";

            Response.TransmitFile(file.FullName);

            Response.End();

Open in new window

0
Comment
Question by:acadenilla
  • 2
4 Comments
 
LVL 29

Assisted Solution

by:David H.H.Lee
David H.H.Lee earned 100 total points
Comment Utility
Hi acadenilla,
Try open the pdf file via "inline" mode instead of "attachment".
eg:
 Response.AddHeader("Content-Disposition", string.Format("inline; filename={0}", file.Name));
           
0
 
LVL 3

Expert Comment

by:OmerFarukZ
Comment Utility
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment; filename=file_long_name.pdf");
Response.ContentType = "application/ms-excel";
0
 
LVL 3

Assisted Solution

by:OmerFarukZ
OmerFarukZ earned 100 total points
Comment Utility
Sorry, please change this line

Response.ContentType = "application/ms-excel";

To

Response.ContentType = "application/octet-stream";

and try again.
0
 

Accepted Solution

by:
acadenilla earned 0 total points
Comment Utility
Thanks guys for the suggestion

i used the following to get it to work
Response.ClearContent();

Response.ClearHeaders();

Response.AppendHeader("Content-Disposition", string.Format("attachment; filename={0}", file.Name));

Response.AppendHeader("Content-Length", file.Length.ToString());

Response.ContentType = "application/pdf";

Response.TransmitFile(file.FullName);

Response.End();

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now