httphandlers to open a pdf in adobe reader instead of using response.binarywrite from the caller
Posted on 2007-11-27
I have an application that is a web based crystal reports generator written in .net 2005. My question is I want to be able to read the pdf in as stream and have it open Adobe Reader but still render the the same "generator" content on the aspx page. I know an alternative solution would be open a new window from the aspx and open the pdf direct in IE using Response.ContentType = "application/pdf"
BUT my project requirements are to open Adobe reader. I can get this functionality directly from the calling aspx page using the following code:
s = New FileStream("somepdf", FileMode.Open, FileAccess.Read)
ReDim Preserve ba(s.Length)
s.Read(ba, 0, s.Length)
but as stated above I want the calling aspx page's content to remain or at least be re-rendered. When using this method I get a blank .aspx page and abobe reader opens. From what I read about httphandlers they could potentially solve this problem but I have no experience with them and I don't know where to begin. Every example I have looked at is very specific to the task at hand... none of which is close to my needs.. So is this a possible solution to my problem, and if so how do I begin? Otherwise I am open to other suggetions..
Thanks in advance