• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 519
  • Last Modified:

Error opening pdf file using ie6 but it works in ie7

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
acadenilla
Asked:
acadenilla
  • 2
3 Solutions
 
David H.H.LeeCommented:
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
 
OmerFarukZCommented:
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment; filename=file_long_name.pdf");
Response.ContentType = "application/ms-excel";
0
 
OmerFarukZCommented:
Sorry, please change this line

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

To

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

and try again.
0
 
acadenillaAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now