S
Sean Kraft
Hello,
I am generating a PDF and writing its bytes to the browser using
Response.BinaryWrite(). Before I do this I set the
response.contenttype = "application/pdf".
When I run in debug I see that the onInit event gets fired twice,
causing my PDF to be generated 2x, to be sure that the debugger is not
causing the problem, I write out a text file in the onInit and run it
compiled, 2 events are firing compiled also.
Here is my code (if I remove Response.ContentType, and
Response.AddHeader onInit only fires once):
//Execute the report
byte[] b = RetrieveReportBytes();
//Return the results
Response.Clear();
Response.ContentType = sContentType;
Response.AddHeader("Content-Disposition", "inline;
filename=Test.pdf");
Response.BinaryWrite(b);
Response.Flush();
Response.End();
I have used this technique many times in the past, and I'm stumped as
to why it now causes this strange behavior.
Thanks,
Sean
I am generating a PDF and writing its bytes to the browser using
Response.BinaryWrite(). Before I do this I set the
response.contenttype = "application/pdf".
When I run in debug I see that the onInit event gets fired twice,
causing my PDF to be generated 2x, to be sure that the debugger is not
causing the problem, I write out a text file in the onInit and run it
compiled, 2 events are firing compiled also.
Here is my code (if I remove Response.ContentType, and
Response.AddHeader onInit only fires once):
//Execute the report
byte[] b = RetrieveReportBytes();
//Return the results
Response.Clear();
Response.ContentType = sContentType;
Response.AddHeader("Content-Disposition", "inline;
filename=Test.pdf");
Response.BinaryWrite(b);
Response.Flush();
Response.End();
I have used this technique many times in the past, and I'm stumped as
to why it now causes this strange behavior.
Thanks,
Sean