View有一个运行SSRS的中央报表服务器,我们所有的reporta都已构建并存在于服务器上。
我现在如何在ASP.NET中使用ReportViewer Contontrol显示其中一个报告?
我的控制:
<rsweb:ReportViewer ID="ctReportViewer" runat="server" />
我的CodeBehind:
var reportServer = ctReportViewer.ServerReport;
reportServer.ReportServerUrl = new Uri(@"http://<MYSERVERNAMEHERE>/reportsdev");
reportServer.ReportPath = @"/OneFm/ArrearCollectionPerRegion";
reportServer.ReportServerCredentials = new ReportViewerCredentials("<USERNAME>", "<PASSWORD>", "<DOMAIN>");
ctReportViewer.DataBind();
public partial class ReportViewerCredentials : IReportServerCredentials
{
private string _userName;
private string _password;
private string _domain;
public ReportViewerCredentials(string userName, string password, string domain)
{
_userName = userName;
_password = password;
_domain = domain;
}
public WindowsIdentity ImpersonationUser
{
get
{
return null;
}
}
public ICredentials NetworkCredentials
{
get
{
return new NetworkCredential(_userName, _password, _domain);
}
}
public bool GetFormsCredentials(out Cookie authCookie,
out string userName, out string password,
out string authority)
{
authCookie = null;
userName = _userName;
password = _password;
authority = _domain;
// Not using form credentials
return false;
}
}
报告链接:
http://<MYSERVERNAMEHERE>/ReportsDev/Pages/Report.aspx?ItemPath=/OneFm/ArrearCollectionPerRegion
我搜索过高低。
我正在运行SSRS2005,如果有任何重要性,我正在使用VS2008。
非常感谢一个例子。
答案 0 :(得分:0)
管理来解决这个问题:
var reportName = "SalesTargets"
ctReportViewer.ServerReport.ReportServerUrl = new Uri("http://<MYREPORTSERVER>/reportserverdev");
ctReportViewer.ServerReport.ReportPath = @"/OneFm/" + reportName;
ctReportViewer.ProcessingMode = ProcessingMode.Remote;
ctReportViewer.ServerReport.Refresh();
ctReportViewer.AsyncRendering = false;
ctReportViewer.SizeToReportContent = true;