SSRS 2016问题与自定义安全扩展(身份验证)

时间:2017-11-20 14:21:45

标签: reporting-services ssrs-2016

我在IIS中托管了一个网站(httphandler),我正在阅读SSRS 2106中的响应(使用HttpWebRequestHttpWebResponse)并将输出流写入Web浏览器和自定义身份验证正在按预期工作。

但是,在身份验证成功之后,我通过向新的Web请求发送新的Web请求来传递SSRS 2016返回的SQLAuthCookie " http://xxxxxx/ Reports/browse"以获得所需的响应但是当我将输出写入浏览器时,我得到一个空白屏幕,看起来我在这里犯了一些错误。

请在下面找到代码段,如果我遗漏了任何内容,请告诉我。 同样的方法适用于SSRS 2012和2014.此外,我的网站和SSRS报告服务器生成的标记是相同的。

身份验证成功后,SSRS返回了SQL身份验证cookie,我将其传回给新请求以获取主页的内容(http://xxxxxx/Reports/browse

处理程序内的代码处理请求方法:

var streamWriter = new StreamWriter(context.Response.OutputStream)
var request = (HttpWebRequest)null;

Uri uri = new Uri("http://xxxxxx/Reports/browse");

request = (HttpWebRequest)HttpWebRequest.Create(uri);

CookieContainer cookieJar = new CookieContainer();

request.CookieContainer = cookieJar;

request.CookieContainer.Add(response.Cookies["SqlAuthCookie"]);
request.KeepAlive = false;
request.Headers.Add("Accept-Language", 
HttpContext.Current.Request.Headers["Accept-Language"]);

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// Get the stream containing content returned by the server.

var dataStream = response.GetResponseStream();
var reader = new StreamReader(dataStream,           
    Encoding.GetEncoding(response1.CharacterSet));
//Read the content
String responseFromServer = reader.ReadToEnd();
streamWriter.Write(responseFromServer);

我得到一个空白页面,看起来CSS和JavaScript没有被调用/加载。

请参阅下面生成的标记 - 显示空白页。



<!DOCTYPE html>
<html lang="en" id="portal" ng-controller="MainController as main" ng-class="{'flex':main.needsCssFlex}" ng-strict-di resizer>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/>
    <title ng-bind="main.documentTitle">Reporting Services Web Portal</title>
    <script type="text/javascript">
        var locName = window.location.pathname.split('/')[1];
        document.write("<base href='/" + locName + "/' />");
        //Favicon Related elements
        var favIconPath = window.location.origin + "/" + locName + "/favicon.ico";
        document.write("<link rel='shortcut icon' href='" + favIconPath + "' />");
        document.write("<link rel='icon' href='" + favIconPath + "' />");
    </script>
    <!--Favicon Related elements-->
    <link rel="apple-touch-icon" sizes="57x57" href="assets/img/fi/apple-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="114x114" href="assets/img/fi/apple-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="72x72" href="assets/img/fi/apple-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="144x144" href="assets/img/fi/apple-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="60x60" href="assets/img/fi/apple-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="120x120" href="assets/img/fi/apple-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="76x76" href="assets/img/fi/apple-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="152x152" href="assets/img/fi/apple-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="assets/img/fi/apple-icon-180x180.png">
    <link rel="icon" type="image/png" sizes="192x192" href="assets/img/fi/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="assets/img/fi/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="96x96" href="assets/img/fi/favicon-96x96.png">
    <link rel="icon" type="image/png" sizes="16x16" href="assets/img/fi/favicon-16x16.png">
    <link rel="manifest" href="assets/img/fi/manifest.json">
    <meta name="msapplication-TileColor" content="#eaeaea">
    <meta name="msapplication-TileImage" content="assets/img/fi/ms-icon-144x144.png">
    <meta name="msapplication-config" content="assets/img/fi/browserconfig.xml">
    <!--End of Favicon Related elements-->
    <!-- css and scripts are injected at build time by gulpfile.js -->
    <script type="text/javascript">
        // inject:css
        document.write("<link rel='stylesheet' href='assets/css/app-284def18-fa92-4a86-b3df-eb5a3ef54387-bundle.min.css'>");
        document.write("<link rel='stylesheet' href='assets/css/brand.css'>");
        // endinject:css
    </script>
</head>
<body ng-class="{'branded':isBranded, 'nonwindows':!main.isWindows}" translate-cloak>
    <div id="page">
        <header navbar-fixed-top" ng-if="showChrome">
            <navbar></navbar>
        </header>
        <section id="subnav" navbar-fixed-top" ng-if="main.serviceState.isAvailable && showChrome">
            <subnav></subnav>
        </section>
        <section id="main" ng-cloak" ng-class="{'hideChrome': !showChrome}">
            <div ui-view></div>
        </section>
    </div>
    <div id="preloader" aria-busy="true" preloader></div>
    <script type="text/javascript">
        // inject:js
        document.write("<script src='assets/js/app-284def18-fa92-4a86-b3df-eb5a3ef54387-bundle.min.js'><\/script>");
        // endinject:js
    </script>
</body>
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案