IWebDocumentViewerExportResultUriGenerator Interface
Allows you to override the default URI that a browser uses to get an export result.
Namespace: DevExpress.XtraReports.Web.WebDocumentViewer
Assembly: DevExpress.XtraReports.v24.2.Web.dll
NuGet Package: DevExpress.Web.Reporting.Common
Declaration
Remarks
Use the IWebDocumentViewerExportResultUriGenerator
service in web applications with header-token authentication to print and export documents if you need to display an export result on a separate page.
On the server side, all requests are processed by a single endpoint:
- the HttpHandler in ASP.NET Web Forms;
- the WebDocumentViewerApiControllerBase descendant Invoke action in ASP.NET MVC;
- the WebDocumentViewerController‘s Invoke action in ASP.NET Core.
When you use header-token authentication in your application, this single endpoint is protected (for instance, with a Bearer token). A web browser cannot obtain the export and print results, because the browser’s requests have no headers and cannot be authenticated.
To enable a browser to get export results, do the following:
Configure another endpoint with a custom protection mechanism instead of header-token authentication.
Implement the
IWebDocumentViewerExportResultUriGenerator
interface and return a custom URI in the CreateUri method. For instance, save an exported document to any storage and return the URI to access this document from the client side.Register the service at the application startup.
You can also use the IWebDocumentViewerExportResultUriGenerator
service to generate a more readable and user-friendly URI. Web browsers display the information obtained from this URI in the tab header.
Note
The complete sample project is available in the following DevExpress Examples repository on GitHub: Web Document Viewer - How to change the name of a print job in the printer’s queue.