在ReportViewer控件中显示SSRS报告
View 有一个运行 SSRS 的中央报表服务器,我们所有的报表都已构建并存在于服务器上。
我现在如何使用 ASP.NET 中的 ReportViewer Control 显示其中一份报告?
我的控制:
<rsweb:ReportViewer ID="ctReportViewer" runat="server" />
我的代码隐藏:
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(如果这有什么意义的话)。
一个例子将不胜感激。
View have a central report server running SSRS, all our reporta are already built and present on the server.
How can i now dispaly one of those reports using ReportViewer Contontrol in ASP.NET?
My Control:
<rsweb:ReportViewer ID="ctReportViewer" runat="server" />
My 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;
}
}
Link to report:
http://<MYSERVERNAMEHERE>/ReportsDev/Pages/Report.aspx?ItemPath=/OneFm/ArrearCollectionPerRegion
I've searched high and low.
I am running SSRS2005, and i am using VS2008 if that counts for anything.
An example would really be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设法弄清楚了:
Managed to figure it out thanx: