asp.net - 通过 URL 访问 SSRS 报告时如何传递凭据

标签 asp.net reporting-services ssrs-2008 ssrs-2008-r2

我正在尝试使用如下 URL 访问 SSRS 报告

http://MyServerIP/ReportServer?/FolderName/ReportName&Param1=ParamValue&rs:Command=Render&rs:Format=HTML4.0&rc:Toolbar=false

当我尝试访问 Url 上方时,系统会要求我提供网络凭据,然后我会在浏览器窗口中呈现所有 SSRS 报告页面。

现在我想在我的 webApp 内的弹出窗口中显示这些内容。为此,我尝试发出 jquery 请求并获取内容,但这样做我得到 401 未经授权的错误。所以我想知道是否有办法在 jquery ajax get 请求中发送凭据。

作为一个转机,我尝试使用下面的 C# 代码来检索数据,但它也没有帮助,并且给出了相同的 401 错误
WebClient client = new WebClient();
client.Credentials = new NetworkCredential("username", "password", "domain");
divContents.InnerText = client.DownloadString(my report path);

我正在使用 SSRS 2008 R2,我的要求是在弹出窗口中显示报告的所有页面。因此,欢迎所有指向这个方向的指针。

最后添加一点,我的 Web 应用程序和报告可能驻留在同一个域中,也可能不驻留在同一个域中。

谢谢,
拉维

最佳答案

我会尝试什么:

  • 创建一个新页面。在 C# 端,使用 ReportExecution2005 Web 服务将您的报告呈现为 HTML。然后将结果泵出到窗口。
  • 在您的弹出窗口中,通过 Ajax 调用新的 C# 页面(以获取 HTML)并将输出注入(inject)您的 jQuery 窗口,或者将页面本身作为单独的浏览器窗口弹出。

  • 如果您需要,我可以提供一些示例代码。

    ETA:我发现了一条可能有值(value)的信息:

    这是来自 HTML Device Settings page (强调我的):

    Toolbar

    Indicates whether to show or hide the toolbar. The default of this parameter is true. If the value of this parameter is false, all remaining options (except the document map) are ignored. If you omit this parameter, the toolbar is automatically displayed for rendering formats that support it.

    The Report Viewer toolbar is rendered when you use URL access to render a report. The toolbar is not rendered through the SOAP API. However, the Toolbar device information setting affects the way that the report is displayed when using the SOAP Render method. If the value of this parameter is true when using SOAP to render to HTML, only the first section of the report is rendered. If the value is false, the entire HTML report is rendered as a single HTML page.

    关于asp.net - 通过 URL 访问 SSRS 报告时如何传递凭据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15816251/

    相关文章:

    asp.net - 在 MVC2 中向用户传递消息

    asp.net - 在 ASP.NET 中存储记录锁定 token

    reporting-services - 格式化 Reporting Services 图表中的嵌套类别组标签

    reporting-services - SSRS 2008 R2 按需向下钻取到子报表

    ssrs-2008 - SSRS BIDS 报告管理器 - 控制

    asp.net - 获取在 AJAX UpdatePanel 中触发回发的 ASP.NET 控件

    reporting-services - 更改堆叠列中系列项目的顺序 (Report Builder 3.0)

    sharepoint - 当数据位于 SharePoint 服务器中时创建 SSRS 报告

    sql-server - 在简单计数和按日期分组中为 NULL 值返回 0

    jquery - 如何在 ASP.NET MVC 3 中自定义不显眼的验证以符合我的风格?