[]
        
(Showing Draft Content)

Setup for ASP.NET Core

Introduction

This guide walks you through configuring the Report Viewer middleware in an ASP.NET Core application. You’ll learn how to install the required packages, register services, and set up the middleware to enable report viewing functionality.

Prerequisites

Before setting up the Report Viewer middleware, ensure that the following NuGet packages are installed in your project:

These packages provide the necessary components for integrating the Report Viewer into your ASP.NET Core application.

Adding the Report Viewer Middleware

To integrate the Report Viewer middleware in an ASP.NET Core application, follow these steps:

  1. Open the Program.cs file in your project.

  2. Register character encodings to ensure proper text rendering by adding System.Text.Encoding.RegisterProvider.

  3. Register the Report Viewer service using AddReportViewer in the IServiceCollection section.

  4. Add the Report Viewer middleware to the request pipeline by calling UseReportViewer.

Example Configuration

Below is a sample configuration for setting up the middleware in Program.cs:

using GrapeCity.ActiveReports.Aspnetcore.Viewer;
using System.Text;

// Register character encodings
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

// Create the WebApplication builder
var builder = WebApplication.CreateBuilder();

// Register the Report Viewer service
builder.Services.AddReportViewer();

var app = builder.Build();

// Add the Report Viewer middleware to the request pipeline
app.UseReportViewer(config =>
{
    // Optional: Configuration options for the report viewer
});

// Run the application
app.Run();

After adding the Report Viewer middleware, the next step is to configure it to meet your application’s needs. For a complete guide on the available configuration options, continue to the Middleware Configuration Options.