views:

322

answers:

2

So... I have an http handler which serves documents. The response contentType is correctly set but the url of the handler does not have an extension i.e. pdf.

It looks like this:

http://mysite/handler.ashx?id=123&locale=123

When I visit this url in firefox/chrome etc (i.e. the decent browsers) all is well (the browser correctly selects a plugin (such as acrobat reader) to render the file within the browser) .

If I visit this url in internet explorer 7, the first time all is well. If I press refresh or visit the url again without closing the browser, I get a dialog that asks "Do you want to open or save this file"!!!! If I click open, nothing happens!

Next I created a redirect page... so I visit

http://mysite/redirectto.aspx?id=123&locale=123

This page just redirects to the original url and still issues mention above occurred.

Not that the same problem occurs for whereever a plugin is required to render the file i.e. tiff files using alternatiff, pdf using acrobat reader - they all have exactly the same issue!

Ideas??

+1  A: 

I've done something similar to this, sadly it was last year, and I'm not at the same campany any more to be able to reference my code to give full solution. What we ended up doing essentially was to use a URL that was for a pdf, but had an http module picking up those requests and dealing with them as required.

Edit - when I say http module, it may have been an http handler or something. Like I said, it was a while ago. The general point is that it was some code that fired as the request came in to the server, before being direct to a page, so our something.pdf was spotted and the data was thrown back at the caller and it just seemed like it was reading a static pdf from the server.

eviltobz
+1  A: 

so...

I created a intermediate page which contains an iframe styled to fill the page. The iframe points at the httphandler. i.e.

This solves the issue for internet explorer.

Crucially this solution requires no additional configuration :)

ListenToRick