[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Collapse]Reporting
 [Expand]Product Information
 [Expand]Get Started with DevExpress Reporting
 [Expand]Create Popular Reports
 [Expand]Detailed Guide to DevExpress Reporting
 [Expand]Visual Studio Report Designer
 [Collapse]Create End-User Reporting Applications
   Cross-Platform Reporting
  [Expand]WinForms Reporting
  [Expand]WPF Reporting
  [Collapse]Web Reporting
   [Expand]General Information
   [Expand]ASP.NET WebForms Reporting
   [Collapse]ASP.NET MVC Reporting
    [Collapse]Document Viewer
     [Expand]HTML5 Document Viewer
     [Collapse]ASP.NET Document Viewer
       Add a Document Viewer to an ASP.NET MVC Application
       GUI
       Display a Remotely Created Document in an ASP.NET MVC
       Customize the Document Viewer Toolbar
       Customize the Color Scheme
    [Expand]End-User Report Designer
     Manual Integration of Reporting Extensions Into an Existing Project
     Application Deployment
   [Expand]ASP.NET Core Reporting
   [Expand]JavaScript Reporting
   [Expand]Application Security
    End-User Documentation
  [Expand]WCF Report Service
  [Expand]Discontinued Platforms
   Localization
   Redistribution and Deployment
 [Expand]API Reference
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Display a Remotely Created Document in an ASP.NET MVC

This tutorial provides an example on how to use an ASP.NET Document Viewer in ASP.NET MVC to publish a document a remote document source provides.

Note

See the Display Documents from the Report and Dashboard Server topic to learn how to show remotely generated reports in the HTML5 Document Viewer.

Expanded Prepare the Server Part

This section describes how to provide an ASP.NET MVC application with a server part (the 'back end') which hosts a Report Service used as a remote document source.

  1. To add a server part to the solution, switch to the Solution Explorer (by pressing CTRL+ALT+L) and right-click the solution. In the invoked context menu, select Add | New Project….

    In the invoked Add New Project dialog, expand the Web category, select ASP.NET Empty Web Application and click OK.

  2. To add a report service to the application's server side, right-click WebApplication1 in the Solution Explorer. In the invoked context menu, select Add | New Item….

    In the invoked Add New Item dialog, expand the Reporting category, select DevExpress v18.2 Report Service and click Add.

    Using the same dialog, add a Report Class to the server part. Provide a layout for the newly added report. See the Create Popular Reports section to learn about the different aspects of designing a report.

Expanded Prepare the Client Part

To display a document obtained from a report service, use the DocumentViewerSettings.SetRemoteSourceSettings method to access and specify the ServiceUri and ReportTypeName properties of the object returned by the DocumentViewerSettings.SettingsRemoteSource property.

The following code is added to the DocumentViewerPartial.cshtml partial view to implement this functionality:

The following code is added to the ExportDocumentViewer action in the HomeController.cs file:

Expanded Publish the Document

Run the application to view the resulting ASP.NET MVC page which displays the created document in the system's default Web browser.

To print or export the document, use the corresponding commands in the ASP.NET Document Viewer Toolbar.

Is this topic helpful?​​​​​​​