Skip to content

DevExpress-Examples/report-and-dashboard-server-integration-with-aspnet-mvc

Repository files navigation

Reporting for Web - How to display documents from the Report and Dashboard Server in an ASP.NET MVC application

This example demonstrates how to use the Report and Dashboard Server's API to obtain report/dashboard documents and display them in the Document/Dashboard Viewers.

The table below lists controls that display documents depending on their types:

Document Type Control Configuration Options
Report ASP.NET MVC Document Viewer Extension WebDocumentViewerSettings.SettingsRemoteSource
Dashboard ASP.NET MVC Dashboard Extension (in the ViewerOnly mode) DashboardExtensionSettings.BackendOptions

Note Before running the example, perform the steps described below in the Report and Dashboard Server Configuration and Application Configuration sections.

Report and Dashboard Server Configuration

  1. Configure the Report and Dashboard Server to use the HTTPS protocol.

  2. Configure the Email Settings required to verify the email address that you enter when you create a new user account in the next step.

  3. Create a user account with Server authentication and give this account permissions to view documents. The account's credentials will be used to obtain a Bearer token, which is required to access the Report and Dashboard Server's API.

  4. Enable Cross-Origin Resource Sharing (CORS) on the screen with the General Settings and restart the DevExpress.ReportServer web site in the Internet Information Services (IIS) Manager to apply the changes.

Application Configuration

  1. In Visual Studio, right-click the solution and select Restore NuGet Packages. You can use the DevExpress Local package source shipped with installation or setup a new package source.

  2. Open the Web.config file and assign your Report and Dashboard Server's URI to the appSettings/ReportServer:BaseUri property.

  3. Create the Web.SECRETS.config* file with the following content and specify the API user name and password.

    <appSettings>
      <add key="ReportServer:UserName" value="api-user-name" />
      <add key="ReportServer:UserPassword" value="api-user-password" />
    </appSettings>

    Review the following blog post for more details: Best practices for private config data and connection strings.

Run the Example

The page displays a list of reports and dashboards available to the current user on the Report and Dashboard Server. When the user clicks the link, the report (or dashboard) is loaded to the viewer.

Files to Review

Documentation

More Examples