Authenticate SSRS on Android


#1

I am happy.

I tested a few competitors but they were difficult to get working. Xibo has fit the bill quite nicely, and since it’s given away free and the Android licenses are quite affordable I feel the need to give back.

I found an easy way to get SSRS to display on Android clients.

I hope this helps.

Create a file on the root of your inetpub folder on your SSRS machine with an asp extension.
(you can get fancy and create a virtual directory and put the file in that folder, but it must use the same domain name due to cross-domain scripting blocking in modern browsers)

Paste the code below and modify the CREDS variable to a user that has access to view the report.

Change the “Link-to-your-report&rs:Command=Render&rc:Toolbar=false” to the location of the report you want to use.

Use a ReportServer link.

ex: http://SSRSServer.domain.com/ReportServer/Pages/ReportViewer.aspx?%2FReport-Folder%2FReport-name&rs:Command=Render&rc:Toolbar=false

In your layout create a region and choose webpage, set the link to http://SSRSServer.domain.com/File-you-created.asp

this will redirect Xibo to your report with the credentials you added to the file.

Code below

 <html>
       <head>
        <script>
     var CREDS=["user","password"];

     function getHTTPObject() {
        if (typeof XMLHttpRequest != 'undefined') {
             return new XMLHttpRequest();
         }
         try {
            return new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
             try {
                 return new ActiveXObject("Microsoft.XMLHTTP");
             } catch (e) {}
         }
         return false;
     }	

     function runReport() {
       var http = getHTTPObject();
       var url= "Link-to-your-report&rs:Command=Render&rc:Toolbar=false";
      http.onreadystatechange = function() {
         if (http.readyState == 4) {
           if (http.status == 401) {
             runReport(); 
          }
           if (http.status == 200) {
             document.location = url;
           }
         }
       };
       http.open("get", url, true, CREDS[0x0], CREDS[0x1]);
       http.send(null);
       return false;
     }
         </script>
       </head>
       <body onload="runReport();">
      </body>

The close html isn’t showing, make sure you close your tags.

I’m sorry if this is common knowledge, but maybe it will save another newb some time and effort.

Reference: https://tickett.wordpress.com/2014/12/03/anonymous-authentication-sql-server-reporting-services/


#2

I am guessing this method is either intended for a newer version of SQL SSRS or where SSRS is not installed in Native Mode. I have SQL 2012 SSRS running in Native Mode and there is no IIS or inetpub directory. I attempted the above putting in the ReportServer directory, but to no avail.