PDF streaming

G

Guest

Hi,
Could someone help me in pointing out what is wrong with this code? This
works as expected in FireFox but not in IE. I have IE 6.0.
I am trying to get a PDF which is hosted on our Intranet, and stream it out
to the Internet users.

Regards,
Amar


WebRequest myRequest = WebRequest.Create("http://intranet/amar/testform.pdf");

WebResponse myResponse = myRequest.GetResponse();

BinaryReader binReader = new BinaryReader(myResponse.GetResponseStream()) ;
byte[] pdfByte =
binReader.ReadBytes(Convert.ToInt32(myResponse.ContentLength));
Response.Clear();
Response.AddHeader("Content-Disposition","attachment;
filename="+"test.pdf");
Response.ContentType="application/pdf";
Response.BinaryWrite(pdfByte);
Response.Flush();
Response.Close();
 
A

Andrea Zani

Amar said:
Hi,
Could someone help me in pointing out what is wrong with this code?
This works as expected in FireFox but not in IE. I have IE 6.0.
I am trying to get a PDF which is hosted on our Intranet, and stream
it out to the Internet users.

Regards,
Amar

Change the line:
Response.AddHeader("Content-Disposition","attachment;
filename="+"test.pdf");
in:
Response.AddHeader("Content-Disposition","inline;filename="+"test.pdf");
 
G

Guest

Hi Andrea,
Thanks for the reponse, but it did not work.
Now it doesnt work on FireFox either.

Amar


Andrea Zani said:
Amar said:
Hi,
Could someone help me in pointing out what is wrong with this code?
This works as expected in FireFox but not in IE. I have IE 6.0.
I am trying to get a PDF which is hosted on our Intranet, and stream
it out to the Internet users.

Regards,
Amar

Change the line:
Response.AddHeader("Content-Disposition","attachment;
filename="+"test.pdf");
in:
Response.AddHeader("Content-Disposition","inline;filename="+"test.pdf");

--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az
 
A

Andrea Zani

Amar said:
Hi Andrea,
Thanks for the reponse, but it did not work.
Now it doesnt work on FireFox either.

Amar

IE/FF show the message "Open" "Save"?

If you write:
Response.ContentType = "application/octet-stream"
?
 
G

Guest

Hi Andrea,
When I replaced “attachment†to “inline†it did not work when I typed the
http://www.Internet.com/stream.aspx (stream.aspx contains the code mentioned
earlier).
Where as If I make http://www.Internet.com/stream.aspx as a link on some
other page and then click the link, it works fine in both IE and FireFox.
Any idea why?


Andrea Zani said:
Amar said:
Hi Andrea,
Thanks for the reponse, but it did not work.
Now it doesnt work on FireFox either.

Amar

IE/FF show the message "Open" "Save"?

If you write:
Response.ContentType = "application/octet-stream"
?

--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top