Archive for the ‘REST’ Category

Serve PDF as inline attachments – WCF REST style

No Comments »

Some time ago, a user with the nickname refaeldakar asked in the WCF/MSDN forum how he could serve PDFs with the WebHttpBinding so that where shown as inline attachments in the web browser.

I wrote a small test application that did what he asked for. The trick here is to add an extra HTTP header to the outgoing response to the web browser; Content-disposition: “inline; filename=filenamehere.pdf".

The code can be found on here.