Search code examples
c#reporting-servicesssrs-2017

Sending custom HTTP headers with an SSRS Rendering Extension


There is a known problem with SSRS Rendering, which is that when rendering PDFs a Content-Disposition: attachment; ... header is sent which forces the file to download rather than open inline (here's an SO thread about it from 2009).

I am wondering if this can be worked around to make the PDF open in the browser by using a Rendering Extension in SSRS. I found an example Rendering Extension in C#, here: https://blogs.technet.microsoft.com/johannh/2017/07/14/creating-and-debugging-a-ssrs-custom-rendering-extension/

However, that code appears to only output a stream. Is it possible to somehow send headers before the stream is sent and therefore override the Content-Disposition header that is usually sent?


Solution

  • I have received a response to a Microsoft ticket from one of the SSRS engineers at Microsoft, who confirmed that SSRS itself sends the Content-Disposition header because it is not intended to be used to serve data, and therefore the Rendering Extensions cannot change the header.

    The proposed solutions suggested by the SSRS engineer were:

    • Use a custom application to strip the header post-rendering and serve the PDF for the user
    • Direct the user to the static PDF after it is generated