Search code examples
javascriptjavaajaxcross-domainssrs-2012

Make SSRS authorization hidden


UPDATE

So, the reason why I tried to do ajax is the login form, which display when user open SSRS reports in the application. I have frame with reports (two different servers) and want make authorization invisible for user in application. For the first server - kuybit I have it, but the SSRS has the other auth form type and I have a trouble with it. If anybody knows better way, except ajax request it can helps.

OLD Q VERSION

I have application and microsoft server for BI report in iframe. I am trying send cross domain ajax request to report server and it doesn't work, because the first request for cross domain is OPTIONS. And my ajax has never worked. My ajax request:

var path = route + ':444/ReportServer/Pages/ReportViewer.aspx' + reportName + '&rs:Command=Render&rc:stylesheet=HideToolBar';
 $.ajax({
   url: path,
   type: 'GET',
   headers: {
      'Access-Control-Allow-Headers': 'Authorization',
      'Content-Type':'application/xml',
      'Authorization' : 'Basic ' + btoa(ssrs_login + ":" + ssrs_password)}
 }).success(function (data) {
     //todo smth
 });

Can anybody helps, please.


Solution

  • To enable CORS to SSRS:

    1. Open Microsoft SQL Server Studio
    2. Connect to Server -> Server type (set it to "Reporting Services")
    3. Login -> right click on the server root node -> Properties
    4. From the Server Properties window select, "Advanced" find "User-defined" and under this heading all CORS settings.

    Set - AccessControlAllowCredentials to true <- to allow passing cookies - AccessControlAllowOrigin to the URL of your other server so the OPTION request can pass