G
Guest
I have pdf files stored in a database image field. I need an aspx page that
will send the pdf to the browser. The code I have (in the page_load event)
works the first time I run it:
[code to query database and put pdf contents into bytearray ba, with length
K omitted]
Response.ContentType = "application/pdf"
Response.Clear()
Response.OutputStream.Write(ba, 0, K)
Response.End()
The first time I run the page, I see the pdf in the browser, as I wish. When
I refresh the page (or change the querystring parameter), I get a white blank
screen in my web browser. I don't know what the browser is doing (IE 6.0).
If I right-click the browser screen and select "View Source", I get a message
from IE "The XML source file is unavailable for viewing".
I also get the following message in the Immediate Window when the
Response.End is executed: "A first chance exception of type
'System.Threading.ThreadAbortException' occurred in mscorlib.dll. An
exception of type 'System.Threading.ThreadAbortException' occurred in
mscorlib.dll but was not handled in user code".
Any clues as how to debug this? Someone else wrote that the above error can
be ignored because it is always generated on Response.End. Is that true? I
don't think this is a caching problem because if I put a debug breakpoint in
the page_load event, the code appears to execute correctly (until it gets to
the response.end).
Joel
will send the pdf to the browser. The code I have (in the page_load event)
works the first time I run it:
[code to query database and put pdf contents into bytearray ba, with length
K omitted]
Response.ContentType = "application/pdf"
Response.Clear()
Response.OutputStream.Write(ba, 0, K)
Response.End()
The first time I run the page, I see the pdf in the browser, as I wish. When
I refresh the page (or change the querystring parameter), I get a white blank
screen in my web browser. I don't know what the browser is doing (IE 6.0).
If I right-click the browser screen and select "View Source", I get a message
from IE "The XML source file is unavailable for viewing".
I also get the following message in the Immediate Window when the
Response.End is executed: "A first chance exception of type
'System.Threading.ThreadAbortException' occurred in mscorlib.dll. An
exception of type 'System.Threading.ThreadAbortException' occurred in
mscorlib.dll but was not handled in user code".
Any clues as how to debug this? Someone else wrote that the above error can
be ignored because it is always generated on Response.End. Is that true? I
don't think this is a caching problem because if I put a debug breakpoint in
the page_load event, the code appears to execute correctly (until it gets to
the response.end).
Joel