如何在ASP.Net和C#网页中将Reporting Services报表显示为内联PDF?

Sop*_*hia 3 .net c# asp.net reporting-services

我需要在ASP.Net网页(使用C#服务器端脚本)中显示报告的预览.预览需要是PDF而不是HTML并以内联方式显示(可能在iframe中?).

是否可以指定呈现为PDF的报表的标题,因此其"内容处置"是内联而不是附件?

或者还有其他方法可以在ASP.Net网页中显示以PDF格式呈现的报表吗?


我正在使用Reporting Services 2008

在ASP.Net站点中,我使用的是对ReportService2005.asmx和ReportExecution2005.asmx的Web引用

Ray*_*Ray 6

我正在做一些非常相似的事情.但我正在使用HttpWebRequest而不是使用该服务.这就是我在做的方式.重要的部分是Content-Disposition中文件名之前的内联.

它还取决于他们的Adobe Reader版本(我们发现他们需要7或更高版本)以及他们在其中设置的设置(如果他们将其设置为不在浏览器中打开PDF).

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();
Run Code Online (Sandbox Code Playgroud)