Opening a file in a browser instead of downloading it

I use ssrs through the report server to generate a resultStream byte array using ReportExecutionService.Render (), which I currently serve for the user with the following code. Is there a way I can use the same byte array to automatically open the report in a new browser window instead of going to the save / open dialog?

   public void RenderReport (byte[] reportDigits, ReportItem reportItem)
   {
      HttpResponse response = HttpContext.Current.Response;
      response.Clear();
      response.ContentType = reportItem.ReportMimeType;
      response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", reportItem.ExportName));
      response.OutputStream.Write(reportDigits, 0, reportDigits.Length);
      response.End();
   }

In the past, I used a separate ReportViewer.aspx page that I would open first and then display the report, but would like to do all of this in code, if possible.

thank

+3
source share
2 answers

:

response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", reportItem.ExportName));

. , mime, .

+3

, - , . - , , .

0

Source: https://habr.com/ru/post/1760339/


All Articles