Hi Kenneth,
Thanks for using Syncfusion products.
This issue is already fixed in our latest version. We are suggesting you to upgrade to the latest version(13.1.0.21) to resolve this issue, else could you please share your current studio version with us? So that we could provide you the prompt solution at the earliest.
Please let us know, if you have any queries.
Regards,
Soundara Rajan S.
Thanks for your phone call. This is what I had posted onto the support form: I am using version 13.1.0.21 and I'm trying to follow the example in the InvoiceDemo.html with modifications to use my Web API and SSRS. From the HTML: When this code executes, it creates a POST with the following Request Header contents: POST /api/SSRS/PostReportAction HTTP/1.1 Host: myAPIServer Connection: keep-alive Content-Length: 178 Accept: application/json, text/javascript, */*; q=0.01 Origin: http://localhost:1337 ejAuthenticationToken: 5AF4E519-5FC3-B6D1-CE26-2A9F0309CF98^container User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Content-Type: application/json; charset=UTF-8 Referer: http://localhost:1337/index.html Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.8,nb;q=0.6 I need to be able to insert the following into this header when ejReportViewer calls the API: Authorization: Basic myEncodedTokenString Is this helpful? | if we set the authorization in control, then windows Authentication credential and other credential authorization keys will be overridden. So that, we are not modifying default authorization header information in control while invoke the Web API. We can able to achieve your requirement in application to override the doAjaxPost method as shown by below code snippet,
For your convenience, we have prepared sample based on this and it can downloaded from below location, http://www.syncfusion.com/downloads/support/directtrac/138925/SSRSDemo-2089929963.zip |
ej.ReportViewer.prototype._exportReport = function (exportType) { if (exportType && exportType.length > 0) { var requrl = this.model.reportServiceUrl + '/PostReportAction'; if ($('#' + this._id + '_exportForm').length > 0) { var _exportForm = $('#' + this._id + '_exportForm'); _exportForm.attr("action", requrl); $('#' + this._id + "_exportKey").val(this._authenticationToken); $('#' + this._id + "_exportRes").val(exportType); $('#' + this._id + "_authorizationKey").val('Key@123'); _exportForm.submit(); } else { var exportForm = document.createElement("form"); $(exportForm).attr({"id":this._id + "_exportForm", "method" : "post", "action": requrl, "data-ajax": "false"});
var exportKey = document.createElement("input"); $(exportKey).attr({ "type": "hidden", "id": this._id + "_exportKey", "name": "controlID", "value": this._authenticationToken });
var exportRes = document.createElement("input"); $(exportRes).attr({ "type": "hidden", "id": this._id + "_exportRes", "name": "resourcetype", "value": exportType });
var exportPrint = document.createElement("input"); $(exportPrint).attr({ "type": "hidden", "id": this._id + "_authorizationKey", "name": "AuthorizationKey", "value": 'Key@123' });
$(exportForm).append(exportKey); $(exportForm).append(exportRes); $(exportForm).append(exportPrint); $('body').append(exportForm); $(exportForm).hide(); $(exportForm).submit(); } } $('#' + this._id + '_toolbar_exportListTip').hide(); |
public object PostReportAction(Dictionary<string, object> jsonResult) { if (jsonResult != null && jsonResult.Count == 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Form["controlID"]) && !string.IsNullOrEmpty(HttpContext.Current.Request.Form["resourcetype"])) { var _authoToken = HttpContext.Current.Request.Form["AuthorizationKey"]; }
return ReportHelper.ProcessReport(jsonResult, this); } |
import { Component } from '@angular/core';
declare let ej: any;
@Component({
selector: 'ej-app',
templateUrl: './report.component.html',
styleUrls: ['./report.component.css']
})
export class ReportViewerComponent {
public serviceUrl: string;
public reportPath: string;
constructor() {
this.serviceUrl = 'http://localhost:57658/api/ReportApi';
this.reportPath = 'Test.rdl';
ej.ReportViewer.prototype.doAjaxPost = function (type, url, jsondata, onSuccess) {
var proxy = this;
var inVokemethod = onSuccess;
var jsonObj = jQuery.parseJSON(jsondata);
if (proxy._reportViewerToken && proxy._reportViewerToken.length > 0) {
jsonObj["reportViewerToken"] = proxy._reportViewerToken;
}
jsondata = JSON.stringify(jsonObj);
$.ajax({
type: type,
url: url,
crossDomain: true,
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: jsondata,
beforeSend: function (req) {
if (inVokemethod == "_getDataSourceCredential") {
var _json = jQuery.parseJSON(this.data);
this.data = JSON.stringify(_json);
}
if (inVokemethod == "_getPageModel" || inVokemethod == "_getPreviewModel") {
if (!proxy._isToolbarClick) {
proxy._showloadingIndicator(true);
} else {
proxy._showNavigationIndicator(true);
}
}
req.setRequestHeader("ejAuthorization", "BearerMyToken");
},
success: function (data) {
if (data && typeof (data.Data) != "undefined") {
data = data.Data;
}
if (typeof (data) == "string") {
if (data.indexOf("Sf_Exception") != -1) {
proxy._showException(true, {
title: "ReportViewer",
content: inVokemethod + ":" + data,
description: 'An error occurred in ajax postback'
});
return;
}
}
if (typeof (data) == "object" && !ej.isNullOrUndefined(proxy.model)) {
proxy._onAjaxSuccess(data);
}
proxy[inVokemethod](data);
},
});
}
}
} |
public object PostReportAction(Dictionary < string, object > jsonResult)
{
if (jsonResult != null && !string.IsNullOrEmpty(HttpContext.Current.Request.Headers["ejAuthorization"]))
{
var _authToken = HttpContext.Current.Request.Headers["ejAuthorization"];
}
return ReportHelper.ProcessReport(jsonResult, this);
} |