Chat Icon
Announcement Speaker Release Announcement: Introducing Bold Reports version 6.1.34! Learn More
Created with Sketch.
Guide to Integrate ASP.NET Core Report Viewer into the .NET 6 App
Guide to Integrating ASP.NET Core Report Viewer into .NET 6 App.

Guide to Integrate ASP.NET Core Report Viewer into the .NET 6 App

At Bold Reports, we are committed to staying at the forefront of technological advancements. With version 4.1, we introduced support for .NET 6.0, empowering developers to leverage the cutting-edge features and capabilities of the framework. In this blog post, we will provide step-by-step details on how to add the ASP.NET Core Report Viewer with .NET 6.0 to your Bold Reports projects using our latest version, 5.1.

Let’s get started!


Before getting started, ensure your development environment includes the following:

  1. Visual Studio 2022 with the ASP.NET and web development workload.
  2. .NET 6 SDK

Create an ASP.NET Core .NET 6 application

  1. Open Visual Studio 2022 and click Create a new project.
Create a new project.
Create a new project.

2. Choose the ASP.NET Core Web App and click Next.

Create an ASP.NET Core Web App
Create an ASP.NET Core web app.

If this template is unavailable, refer to this link to configure the system environment.

3. Provide a project name and then click Create.

4. Ensure that the .NET 6.0 version is selected and click Create. Your ASP.NET Core web app will be created and loaded in Visual Studio.

Choose .NET 6.0 as the framework.
Choose .NET 6.0 as the framework.

Install the NuGet packages

To get the tag helpers to create a client-side report viewer component, you need to install the package BoldReports.AspNet.Core. Also install the package BoldReports.Net.Core that contains APIs to process the report viewer file and data actions.

Follow these steps to install the NuGet packages:

  1. In the Solution Explorer tab, right-click the project or solution and choose Manage NuGet Packages.
  2. In the browser tab, search for the BoldReports.AspNet.Core package and install it in your ASP.NET Core application. Similarly, install the package BoldReports.Net.Core.
Installing the Bold Reports ASP.NET Core Reporting NuGet Package for .NET 6 Support.
Installing the Bold Reports ASP.NET Core Reporting NuGet Package.

Refer to scripts and CSS

Next, reference the following online CDN links in the _Layout.cshtml file within the head tag. Also, the Report Viewer scripts and styles can be added into your application by installing the BoldReports.JavaScript NuGet package.

<link href="" rel="stylesheet" />
<script src="" type="text/javascript"></script>

<!--Render the gauge item. Add this script only if your report contains the gauge report item. -->
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>

<!--Render the map item. Add this script only if your report contains the map report item.-->
<script src=""></script>

<script src=""></script>
<script src=""></script>

<!--Render the chart item. Add this script only if your report contains the chart report item.-->
<script src=""></script>

<!-- Report Viewer component script-->
<script src=""></script>

Since I have added the jQuery file to render the Report Viewer, remove the existing reference to jQuery, which has already been generated along with the project template.

@*<script src="~/lib/jquery/dist/jquery.min.js"></script>*@

Define tag helper

To initialize the Report Viewer component with the support of a tag helper, define the following tag helper in the ~/Pages/_ViewImports.cshtml file.

@using BoldReports.TagHelpers
@addTagHelper *, BoldReports.AspNet.Core

Configure script manager

To manage the scripts related to reporting, add the script manager tag at the end of the body tag in the ~/Pages/Shared/_Layout.cshtml page.

 @await RenderSectionAsync("Scripts", required: false) 
 <!-- Bold Reports script manager -->   

Initialize ASP.NET Core Report Viewer

  1. Open the Index.cshtml page.
  2. Remove the existing code and add the following code.
    <div style="min-height: 600px;width: 100%;">
        <bold-report-viewer id="viewer"></bold-report-viewer>

Add already created reports

  1. Create a Resources folder in the wwwroot folder in your application to store the RDL reports.
  2. Download the sales-order-detail.rdl file from here. For more sample reports, refer to the samples and demos section.
  3. Extract the compressed file and paste the sales-order-detail.rdl file to the Resources folder.

Setting up the web API service for the ASP.NET Core Report Viewer

Next, you need to create a Web API controller to process the SSRS RDL and RDLC report files:

  1. Right-click the project file; in the context menu, select Add > New Item
  2. In the Add New Item dialog, select API controller – Empty
  3. Name it ReportViewerController.cs and then click Add.
  4. In the ReportViewerController class, implement the IReportController interface from the namespace BoldReports.Web.ReportViewer. The IReportController interface’s implementation is required for processing the reports and for handling requests from the Report Viewer.
  5. Set the Route attribute for the ReportViewerController class.
public class ReportViewerController : Controller, IReportController
    { …

6. Within the ReportViewerController class, replace the template code with the following code.

public class ReportViewerController : Controller, IReportController
 // Report Viewer requires a memory cache to store the information of consecutive client requests 
 //and have the rendered Report Viewer information in the server.
 private Microsoft.Extensions.Caching.Memory.IMemoryCache _cache;

 // IWebHostEnvironment used with sample to get the application data from wwwroot.
 private Microsoft.AspNetCore.Hosting.IWebHostEnvironment _hostingEnvironment;

 // Post action to process the report from server-based JSON parameters and send the result back to the client.
 public ReportViewerController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache,
 Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment)
  _cache = memoryCache;
  _hostingEnvironment = hostingEnvironment;

 // Post action to process the report from server-based JSON parameters and send the result back to the client.
 public object PostReportAction([FromBody] Dictionary<string, object> jsonArray)
  //Contains helper methods that help process a Post or Get request from the Report Viewer control and return the response to the Report Viewer control.
  return ReportHelper.ProcessReport(jsonArray, this, this._cache);

 // Method will be called to initialize the report information to load the report with ReportHelper for processing.
 public void OnInitReportOptions(ReportViewerOptions reportOption)
  string basePath = _hostingEnvironment.WebRootPath;
  // Here, we have loaded the sales-order-detail.rdl report from the application folder wwwroot\Resources. The sales-order-detail.rdl file should be in the wwwroot\Resources application folder.
  FileStream inputStream = new FileStream(basePath 
  + "\\Resources\\" + reportOption.ReportModel.ReportPath, 
  FileMode.Open, FileAccess.Read);
  MemoryStream reportStream = new MemoryStream();
  reportStream.Position = 0;
  reportOption.ReportModel.Stream = reportStream;

 // Method will be called when report is loaded internally to start to layout process with ReportHelper.
 public void OnReportLoaded(ReportViewerOptions reportOption)

 //Get action for getting resources from the report.
 // Method will be called from Report Viewer client to get the image src for the Image report item.
 public object GetResource(ReportResource resource)
  return ReportHelper.GetResource(resource, this, _cache);

 public object PostFormReportAction()
  return ReportHelper.ProcessReport(null, this, _cache);

7. In the Program.cs file, call the app object’s MapControllers method immediately after app.UseRouting(), as shown in the following code. This ensures that your application is aware of all the controllers and can route incoming requests correctly to the corresponding action methods.


Configuring the report path and service URL for the ASP.NET Core Report Viewer

  1. To render the reports in the application, you need to provide the report’s path and the report service you created to the Report Viewer component.
  2. To do so, open the Index.cshtml page.
  3. Set the report-path and report-service-url properties of the Report Viewer component, as in the following code. Remember that we already added the sales-order-detail.rdl report in the Resources folder in the application.
<div style="min-height: 600px;width: 100%;">
   <bold-report-viewer id="viewer" 

That’s it! Now, you have configured all the necessary settings to run the ASP.NET Core .NET 6 application and display the RDL report.

Run the .NET 6 application

Build and run the application to view the report output in the Report Viewer as displayed in the following image.

The ASP.NET Core Report Viewer in a .NET 6 app
The ASP.NET Core Report Viewer in a .NET 6 app


I hope this blog provided sufficient guidance for integrating the Report Viewer component into a .NET 6 application. To explore more about the Report Viewer for ASP.NET Core and use report items in it, look through our documentation site. To experience the features live, please check out our demo samples and solutions.

If you have any questions, please post them in the comments section. You can also contact us through our contact page, or if you already have an account, you can log in to ask your support question.

Bold Reports now offers a 15-day free trial without any credit card information required. We welcome you to start a free trial and experience Bold Reports for yourself. Try it and let us know what you think!

Catch us on our official TwitterFacebook, and LinkedIn pages for info about upcoming releases.


Share this blog

Leave a Reply

Your email address will not be published. Required fields are marked *