关于asp.net:如何从DMZ中的ReportViewer控件查看SQL Server 2005 Reporting Services报表

关于asp.net:如何从DMZ中的ReportViewer控件查看SQL Server 2005 Reporting Services报表

How do you view SQL Server 2005 Reporting Services reports from ReportViewer Control in DMZ

我希望能够通过ReportViewer控件从DMZ中的ASP.NET应用程序查看SQL Server 2005 Reporting Services报告。 SQLand SSRS服务器在防火墙后面。


`因此,我不得不更改ASP.NET 2.0应用程序从页面调用报表的方式。最初,我使用JavaScript打开一个新窗口。

1
ViewCostReport.OnClientClick ="window.open('" + Report.GetProjectCostURL(_PromotionID) +"','ProjectCost','resizable=yes')";

我遇到的问题是window.open调用只能在客户端网络内运行,而不能在位于其DMZ中的新Web服务器上运行。我必须创建一个新的报表WebForm,该WebForm嵌入了一个ReportViewer控件以查看报表。

我遇到的另一个问题是,必须使用Windows身份验证来访问报表服务器,因为该报表服务器被另一个应用程序用于报表,并且该应用程序使用角色进行报表访问。因此,我关闭了ReportViewer控件来模拟Windows用户。我发现解决方案是这样的:

创建一个新类,该类实现用于访问报告的Microsoft.Reporting.WebForms.IReportServerCredentials接口。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public class ReportCredentials : Microsoft.Reporting.WebForms.IReportServerCredentials
{
    string _userName, _password, _domain;
    public ReportCredentials(string userName, string password, string domain)
    {
        _userName = userName;
        _password = password;
        _domain = domain;
    }

    public System.Security.Principal.WindowsIdentity ImpersonationUser
    {
        get
        {
            return null;
        }
    }

    public System.Net.ICredentials NetworkCredentials
    {
        get
        {
            return new System.Net.NetworkCredential(_userName, _password, _domain);
        }
    }

    public bool GetFormsCredentials(out System.Net.Cookie authCoki, out string userName, out string password, out string authority)
    {
        userName = _userName;
        password = _password;
        authority = _domain;
        authCoki = new System.Net.Cookie(".ASPXAUTH",".ASPXAUTH","/","Domain");
        return true;
    }
}

然后,我为按钮创建了一个事件以调用报告:

1
2
3
4
5
6
7
8
9
10
11
12
protected void btnReport_Click(object sender, EventArgs e)
{
    ReportParameter[] parm = new ReportParameter[1];
    parm[0] =new ReportParameter("PromotionID",_PromotionID);
    ReportViewer.ShowCredentialPrompts = false;
    ReportViewer.ServerReport.ReportServerCredentials = new ReportCredentials("Username","Password","Domain");
    ReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
    ReportViewer.ServerReport.ReportServerUrl = new System.Uri("http://ReportServer/ReportServer");
    ReportViewer.ServerReport.ReportPath ="/ReportFolder/ReportName";
    ReportViewer.ServerReport.SetParameters(parm);
    ReportViewer.ServerReport.Refresh();
}

推荐阅读

    查看linux常用命令?

    查看linux常用命令?,系统,工作,命令,工具,地址,信息,基础,目录,网络,管理,Lin

    linux命令查看命令?

    linux命令查看命令?,系统,地址,信息,情况,工作,命令,标准,工具,文件,内容,lin

    linux补丁查看命令?

    linux补丁查看命令?,系统,工作,管理,命令,情况,官方网站,基础,检测,工具,目

    查看linux可用命令?

    查看linux可用命令?,信息,系统,工作,命令,位置,时间,地址,标准,通用,名称,Lin

    linux查看大小命令?

    linux查看大小命令?,系统,设备,档案,电脑,信息,软件,单位,状态,大小,文件夹,

    linux查看命令行进程?

    linux查看命令行进程?,系统,软件,信息,状态,进程,名称,实时,命令,数据,电脑,

    linux命令查看日历?

    linux命令查看日历?,系统,工作,信息,命令,世纪,公式,时间,管理,代码,设备,基

    linux命令查看端口?

    linux命令查看端口?,系统,情况,地址,灵活,状态,信息,工具,网络,端口,终端,LIN

    linux查看缩写的命令?

    linux查看缩写的命令?,工作,地址,汽车,系统,信息,命令,标准,目录,动力,车辆,L

    linux查看扩展名命令?

    linux查看扩展名命令?,工作,系统,地址,信息,软件,文件,标准,电脑,命令,目录,L

    linux查看任务命令?

    linux查看任务命令?,系统,管理,情况,状态,任务,进程,命令,定期,信息,作业,lin

    查看linux命令提示符?

    查看linux命令提示符?,系统,名称,网络,命令,信息,对比,工具,实时,日志,文件,l

    linux命令查看连接数?

    linux命令查看连接数?,数字,对比,网络,系统,数据,地址,状态,通讯,信息,命令,l

    如何查看linux命令行?

    如何查看linux命令行?,信息,系统,软件,服务,状态,地方,工具,数据,命令,进程,l

    linux命令查看连接数?

    linux命令查看连接数?,数字,对比,网络,系统,数据,地址,状态,通讯,信息,命令,l

    linux下查看命令记录?

    linux下查看命令记录?,信息,地址,系统,时间,服务,命令,名称,数据,环境,数字,

    查看linux命令提示符?

    查看linux命令提示符?,系统,名称,网络,命令,信息,对比,工具,实时,日志,文件,l

    查看linux带宽命令?

    查看linux带宽命令?,工具,系统,网络,工作,状态,地址,情况,信息,实时,分析,Lin

    linux查看ip命令?

    linux查看ip命令?,地址,网络,系统,信息,设备,电脑,名称,状态,中心,终端,如何

    查看linux用户命令行?

    查看linux用户命令行?,信息,系统,时间,名称,密码,用户,命令,地址,状态,设备,L