1

I have a website (an httphandler) hosted in IIS and I am reading the response (using HttpWebRequest and HttpWebResponse) from SSRS 2106 and writing the output stream on to the Web browser and the custom authentication is working as expected.

However, after the authentication is successful, I am passing this SQLAuthCookie returned by SSRS 2016 by making a new web request to "http://xxxxxx/ Reports/browse" to get the required response back but when I write the output to the browser I am getting a blank screen, looks like I am making some mistake here.

Please find below the code snippet and let me know if I am missing anything. The same approach is working fine with SSRS 2012 and 2014. Also, the markup generated by my website and the SSRS report server are same.

After the authentication is successful, the SSRS has returned the SQL auth cookie and I am passing it back with a new request to get the contents of the home page (http://xxxxxx/Reports/browse )

Code inside the handler Process request method:

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);

I am getting a blank page, looks like the CSS and JavaScript is not getting called/loaded.

Please see below the generated markup - which shows the blank page.

<!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>
stefanobaghino
  • 11,253
  • 4
  • 35
  • 63
Glads
  • 11
  • 3

0 Answers0