This example demonstrates how to use the Report and Dashboard Server's API to obtain available documents and display them in the Document/Dashboard Viewers.
The table below lists the controls that display documents depending on their types:
Document Type | Control | Configuration Options |
---|---|---|
Report | ASP.NET Core Document Viewer | WebDocumentViewerBuilder.RemoteSourceSettings |
Dashboard | ASP.NET Core Dashboard Control (in the ViewerOnly mode) | DashboardBuilder.BackendOptions |
Before running the example, perform the following steps:
1. Configure the Report and Dashboard Server
-
Configure the Report and Dashboard Server to use the HTTPS protocol.
-
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.
-
Enable Cross-Origin Resource Sharing (CORS) on the screen with the General Settings and restart the Report and Dashboard Server to apply the changes.
2. Download Resources and Specify Server Settings
-
Refer to the https://nuget.devexpress.com/#feed-url page and obtain the NuGet Feed URL. This URL includes your personal feed authorization key.
-
Open the console and navigate to the example's CS folder. Run the commands below to restore dependencies from the DevExpress (with the obtained NuGet Feed URL) and default NuGet package sources:
dotnet restore -s https://nuget.devexpress.com/<auth_key>/api
dotnet restore
-
Use the following command to install all the necessary npm packages:
npm ci
-
Open the appsettings.json file and assign your Report and Dashboard Server's URI to the ReportServerBaseUri property.
-
In the console, generate user secrets for the Server account's username and password:
dotnet user-secrets set "ReportServer:UserName" "<username>"
dotnet user-secrets set "ReportServer:UserPassword" "<password>"
-
Run the command below to trust the HTTPS certificate for ASP.NET Core development:
dotnet dev-certs https --trust
Run the Example
Use the following command to build the example:
dotnet run
Open your browser on http://localhost:5000/ or https://localhost:5001/ to see the result.