使用 SSRS 呈现扩展发送自定义 HTTP headers

Sending custom HTTP headers with an SSRS Rendering Extension

SSRS 呈现存在一个已知问题,即在呈现 PDF 时会发送 Content-Disposition: attachment; ... header,这会强制下载文件而不是直接打开文件 (here's an SO thread about it from 2009) .

我想知道是否可以解决这个问题,通过在 SSRS 中使用 Rendering Extension 在浏览器中打开 PDF。我在 C# 中找到了一个示例渲染扩展,在这里: https://blogs.technet.microsoft.com/johannh/2017/07/14/creating-and-debugging-a-ssrs-custom-rendering-extension/

但是,该代码似乎只输出一个流。是否可以在发送流之前以某种方式发送 headers 并因此覆盖通常发送的 Content-Disposition header?

我收到了 Microsoft 的一位 SSRS 工程师对 Microsoft 票证的回复,他确认 SSRS 本身会发送 Content-Disposition header,因为它不打算用于服务数据,因此渲染扩展无法更改 header.

SSRS工程师建议的方案是:

  • 使用自定义应用程序剥离 header post-rendering 并为用户提供 PDF
  • 生成静态 PDF 后将用户定向到它