I need to display a preview of a report, in an ASP.Net web page (using C# server side scripts). The preview needs to be a PDF rather than HTML and displayed inline (possibly in an iframe?).
Is it possible to specify the headers of a report rendered as a PDF, so its 'Content-Disposition' is inline rather than attachment?
Or is there any other way to display a report rendered as a PDF inline in an ASP.Net web page?
I am using Reporting Services 2008
In the ASP.Net site I am using web references to ReportService2005.asmx and ReportExecution2005.asmx
I'm doing something that is very similar. But I'm using a HttpWebRequest instead of using the service. Here's how I'm doing it. The important part is the inline before the file name in the Content-Disposition.
It also depends on their version of Adobe Reader (we found they need 7 or upwards) and the settings they have set inside it (in case they've set it to not open PDFs inside the browser).
HttpResponse currentResponse = HttpContext.Current.Response;
currentResponse.Clear();
currentResponse.ClearHeaders();
currentResponse.ClearContent();
filename = String.Format("{0}.pdf", this.ReportName);
currentResponse.AppendHeader("Content-Disposition", String.Format("inline;filename={0}", filename));
currentResponse.ContentType = "Application/PDF";
//Copy the content of the response to the
//current response using BinaryWrite
snip....
currentResponse.End();