G
Guest
Hi All,
I’m trying to stream a PDF with .NET 2.0 in a c# web app. However, it does
not actually show the PDF (using adobe acrobat).
The Situation:
Click on a Button, Opens a new Window, which generates a PDF, then streams
it out to the client. (So the can get the window of acrobate, isnide of IE).
However.. After 5 hours of stuffing around, I am at a loss.
Normally, I would do:
byte[] PDFByteArray = new byte[0];
PDFByteArray = GeneratePDF()
Context.Response.ClearContent();
Context.Response.ClearHeaders();
Context.Response.AddHeader("content-disposition",
"filename=Rename_File.pdf");
Context.Response.ContentType="application/pdf";
Context.Response.AddHeader("content-length",
PDFByteArray.Length.ToString());
Context.Response.BinaryWrite(PDFByteArray);
Context.Response.Flush();
Context.Response.End();
Doing this, does actually send the PDF to IE (using packet sniffers),
however, IE. goes to "about:blank".
However, this is a valid PDF, if i write it to a file, from the sabe byte
array instad of streaming it out, the PDF writes and then opens fine in Adobe.
So I dug a little more and noticed something, which may or may not affect
it. The HTTP headers for the page, in .NET 2.0 are in a different order then
..NET 1.1. Could this be the issue? Everything else is the same, encoding,
content length, etc, except for the .NET framework version. Works in 1.1,
does noting 2.0.
Other paths I have tried.. Creating a HttpWebRequest from the page, and then
streaming that from the other page... same result, PDF is sent to the
browser, but IE, goes to "About:blank"
Any ideas, suggestions or comments will be greatly appreciated. At this
stage.. I mean ANYTHING, even random thoughts on the subject as I have
exhausted all avenues I can think of.
Regards,
Daniel Brown
I’m trying to stream a PDF with .NET 2.0 in a c# web app. However, it does
not actually show the PDF (using adobe acrobat).
The Situation:
Click on a Button, Opens a new Window, which generates a PDF, then streams
it out to the client. (So the can get the window of acrobate, isnide of IE).
However.. After 5 hours of stuffing around, I am at a loss.
Normally, I would do:
byte[] PDFByteArray = new byte[0];
PDFByteArray = GeneratePDF()
Context.Response.ClearContent();
Context.Response.ClearHeaders();
Context.Response.AddHeader("content-disposition",
"filename=Rename_File.pdf");
Context.Response.ContentType="application/pdf";
Context.Response.AddHeader("content-length",
PDFByteArray.Length.ToString());
Context.Response.BinaryWrite(PDFByteArray);
Context.Response.Flush();
Context.Response.End();
Doing this, does actually send the PDF to IE (using packet sniffers),
however, IE. goes to "about:blank".
However, this is a valid PDF, if i write it to a file, from the sabe byte
array instad of streaming it out, the PDF writes and then opens fine in Adobe.
So I dug a little more and noticed something, which may or may not affect
it. The HTTP headers for the page, in .NET 2.0 are in a different order then
..NET 1.1. Could this be the issue? Everything else is the same, encoding,
content length, etc, except for the .NET framework version. Works in 1.1,
does noting 2.0.
Other paths I have tried.. Creating a HttpWebRequest from the page, and then
streaming that from the other page... same result, PDF is sent to the
browser, but IE, goes to "About:blank"
Any ideas, suggestions or comments will be greatly appreciated. At this
stage.. I mean ANYTHING, even random thoughts on the subject as I have
exhausted all avenues I can think of.
Regards,
Daniel Brown