Response and try/catch Statements
Writing a few methods for writing out the PDFs from ActiveReports, I came across an odd behavior in IE. Before I added in thet try/catch statements, the PDFs would open just fine in the browser using the inline viewer (as specified); however, after adding the try/catch, it would open up a Save As dialog with the note that the browser felt the file didn’t match the extention.
So, what’s the fix? After a bit of dinking around, it seemed the issue was that the Response object was losing scope during that try/catch and never being ‘ended’ when it was ‘finally’ done.
The fix was to add a finally clause and add Response.End to that section rather than within the method I had to stream the PDF memorystream OR within the try statement.
finally
{
Response.End();
}