Current filter:
                                You should refresh the page.
                                  • HI,

                                    I'm using the defaults controller integrated with ASP.Net Core / Angular.

                                          SerializationService.RegisterSerializer(CustomUntypedDataSetSerializer.Name, new CustomUntypedDataSetSerializer());
                                          DevExpress.XtraReports.Web.Extensions.ReportStorageWebExtension.RegisterExtensionGlobal(new ReportStorageWebExtension1(reportStorage, reportApp));

                                    I'm serving an Angular SPA from ASP.NET Core using the link:

                                    But I need to authorize the call to the viewer using attribute authorize.
                                    So, I think i need to use the WebDocumentViewerController class the put the attribute.

                                    Then, how i register the custom class "WebDocumentViewerController " in my backEnd ASP.Net core



                                    using DevExpress.AspNetCore.Reporting.WebDocumentViewer;
                                    using DevExpress.AspNetCore.Reporting.WebDocumentViewer.Native.Services;
                                    using Microsoft.AspNetCore.Cors;
                                    using Microsoft.AspNetCore.Mvc;
                                    using System;
                                    using System.Collections.Generic;
                                    using System.Linq;
                                    using System.Threading.Tasks;

                                    namespace TRF.Rpt.Host
                                      public class CustomWebDocumentViewerController : WebDocumentViewerController
                                        public CustomWebDocumentViewerController(IWebDocumentViewerMvcControllerService controllerService) : base(controllerService) { }
                                        public override Task<IActionResult> Invoke()
                                          return base.Invoke();

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Luiz,

                                >>How i register the custom class "WebDocumentViewerController " in my backEnd ASP.Net core
                                To remove the default controllers implementation, use the code illustrated in the following help topic: Swagger is not working in a project that uses ASP.NET Core Reporting components. I believe we already discussed the different between automatic and manual controllers registration in the T687668 and T703858 threads. Please refer to them if you'd like to refresh your knowledge.

                                >>So, I think i need to use the WebDocumentViewerController class the put the attribute.
                                That is absolutely correct, but there is more to that. It's also necessary to use the DevExpress.Analytics.Utils.ajaxSetup.ajaxSettings property to specify default settings used for requests sent by our HTML5 Reporting components to the web server.
                                However, not all requests to the web server made by our HTML viewer use the ajax function. The HTML5 Document Viewer's request that gets the exported document and the request to print the document are GET  requests made with, so you cannot pass your header token to the server when these requests are executed. Without a token there is no permission to access a particular resource, and that's why printing and exporting won't work by default. The solution here is to enable the asynchronous export mechanism as illustrated in the following GitHub example:  Web Document Viewer - How to export documents in an application with token-based authentication. It's for the classic MVC 3-5 project type, but the same idea applies to .NET Core as well, it's only the controllers that are different there:

                                import { Component, ViewEncapsulation, ViewChild } from '@angular/core'; import DevExpress from '@devexpress/analytics-core'; import { Report } from "devexpress-reporting/dx-webdocumentviewer"; import { DxReportViewerComponent } from 'devexpress-reporting-angular'; @Component({ templateUrl: './report-viewer.component.html', encapsulation: ViewEncapsulation.None, styleUrls: [ './report-viewer.component.scss' ] }) export class ReportViewerComponent { reportUrl = 'Report'; hostUrl = 'https://localhost:44362'; invokeAction = '/DXXRDV'; serverUrl = this.hostUrl + this.invokeAction; token = sessionStorage.getItem('adal.idtoken'); constructor() { DevExpress.Analytics.Utils.ajaxSetup.ajaxSettings = { headers: { 'Authorization': 'Bearer ' + this.token } }; Report.Preview.AsyncExportApproach = true; } }

                                Give this approach a try and let us know if there any issues with its implementation. I'm here to help should you need to discuss things further.
                                Note: the ajaxSetup.ajaxSettings option does not work in version 19.1.3 because of a regression, an update to v19.1.4 is required: Angular Reporting - DevExpress.Analytics.Utils.ajaxSetup.ajaxSettings does not work in v19.1


                                • Luiz Bilhalva 02.11.2019

                                  Thanks Yaroslav,

                                  But this aproach work only i call the mannually viewer .

                                  When i call the viewer into the designer (click button viewer) this aproach doesnt't work.

                                • Luiz Bilhalva 02.11.2019


                                  This aproach worked for me.

                                  I forgot register DXXRD route.


                                    [ApiExplorerSettings(IgnoreApi = true)]
                                    public class CustomReportDesignerController : ReportDesignerController
                                      public CustomReportDesignerController(IReportDesignerMvcControllerService controllerService) : base(controllerService) { }
                                      public override Task<IActionResult> Invoke()
                                        return base.Invoke();

                                • Yaroslav (DevExpress Support) 02.11.2019

                                  Excellent - happy to hear things worked out well, Luiz.
                                  Should there be further questions, we're here to help.