G
Guest
I am looking for the most correct method of streaming a byte array to a web
browser as a pdf. Anyway, I see a lot of methods for HttpResponse and I don't
know how to properly use them. Here is my code:
Response.ContentType = "Application/pdf";
Response.BinaryWrite(myByteArray);
Response.End();
Specifically, do I need to worry about Buffer (T/F), AppendHeader(),
Clear(), Flush(). Should I use OutputStream instead of BinaryWrite?
My code is working, but I want to know if it is the right way to do this so
that I don't encounter errors down the road, e.g. problems if a file size is
large, or memory leaks.
Also, on Response.End a 'Thread was being aborted' exception that I guess is
expected behavior. I plan to just catch this specific exception and do
nothing with it, is that the way to handle it?
browser as a pdf. Anyway, I see a lot of methods for HttpResponse and I don't
know how to properly use them. Here is my code:
Response.ContentType = "Application/pdf";
Response.BinaryWrite(myByteArray);
Response.End();
Specifically, do I need to worry about Buffer (T/F), AppendHeader(),
Clear(), Flush(). Should I use OutputStream instead of BinaryWrite?
My code is working, but I want to know if it is the right way to do this so
that I don't encounter errors down the road, e.g. problems if a file size is
large, or memory leaks.
Also, on Response.End a 'Thread was being aborted' exception that I guess is
expected behavior. I plan to just catch this specific exception and do
nothing with it, is that the way to handle it?