There appears to be some confusion on some of the replies so let me make this a little clearer:
Two ASPX pages in the same application:
http://www.myroot.com/PDFPage1.aspx
http://www.myroot.com/PDFPage2.aspx
PDFPage1.aspx has existed for years and works beautifully.
PDFPage2.aspx is a new copy of PDFPage1.aspx. It does not work as expected
The code that calls the PDF file and displays it is identical in the example code I provided. There is a difference in that this code is inside different conditional logic blocks on the two pages. That should not matter, but maybe someone has a different
opinion on that topic.
I tested this code multiple times with only one PDF document, so I can verify the code on both pages is being executed. Both pages are attempting to load the exact same PDF document. Page1 succeeds and Page2 fails. The PDF I am using is 60K.
Page1 has worked for PDF documents that range in size from a few K to over 50 MB in size.
Whew. I hope that makes it perfectly clear. I hope someone can help me here. My gut feeling is that the existence of conditional logic is confusing ASP.NET somehow.