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
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();