Problem of asp.net content streaming PDF not functioning in some browsers

Asked By 60 points N/A Posted on -
qa-featured

What are the possible omissions or problems on asp.net code not content streaming pdf on some browsers for some application I developed?

 
SHARE
Best Answer by marsh watson
Answered By 0 points N/A #131868

Problem of asp.net content streaming PDF not functioning in some browsers

qa-featured

Hello Julia,

Hope you are doing well!

I have faced this a many times and mostly with IE, the below is what I had tried once.

Response.AddHeader("Content-Disposition", "attachment;filename=" + attachment.Name);

 

 
To
 
Response.AddHeader("Content-Disposition", "inline;filename=" + attachment.Name);
 
Also, you can refer to the below link which I feel might help.
 
 
 
Hope this answers your question.
 
Regards,
Romil
Best Answer
Best Answer
Answered By 0 points N/A #131869

Problem of asp.net content streaming PDF not functioning in some browsers

qa-featured

 

Hello Julia Daniele,

You must not worry at all about this issue. This is a very common problem with asp.net and different browsers. To get this problem fixed in IE, you have to include the file length in the header for pdf to work. Give a try with this code;

Response.Buffer = true;

Response.ContentType = “application.pdf”;

Response.AddHeader(“Content-Disposition”,”attachment;filename=” + FileName );

Response.OutputStream.Write(dataBytes,0,FileContentLength);

 

Hopefully, this will work.

Login/Register to Answer

Related Questions