.NET 6.0 framwork SSRS Report Viewer.

santhosh shekar 15 Reputation points
2023-09-05T14:43:03.99+00:00

Hi Team,

I am using .Net 6.0 farmwork with MVC. Not able to bind Report viewer in razor pages. .Net 6.0 not supporting old packages and web forms. How to bind SSRS rdl in .Net 6.0 MVC framework.

Kindly provide a solution with an example source code.

Thanks

Santhosh

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,166 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,256 questions
SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,799 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Muhammad Binyameen 390 Reputation points
    2023-09-05T17:16:20.9933333+00:00
    To bind an SSRS (SQL Server Reporting Services) report in a .NET 6.0 MVC framework, you can follow these steps:
    
    1. Install the necessary packages:
       - Microsoft.ReportingServices.ReportViewerControl.WebForms: This package provides the ReportViewer control for web applications.
       - Microsoft.ReportingServices.ReportViewerControl.WinForms: This package provides the ReportViewer control for Windows Forms applications.
    
    Since you mentioned that .NET 6.0 does not support old packages and web forms, you can try using the new ASP.NET Core Reporting Services package called "Microsoft.AspNetCore.Mvc.ReportViewer" instead. This package provides a ReportViewer control specifically designed for ASP.NET Core.
    
    To install the "Microsoft.AspNetCore.Mvc.ReportViewer" package, please run the following command in the Package Manager Console:
    

    Install-Package Microsoft.AspNetCore.Mvc.ReportViewer -Version 1.1.1

    
    2. Once the package is installed, add the following namespaces to your Razor Pages:
       ```csharp
       using Microsoft.AspNetCore.Mvc.Reporting;
       using Microsoft.AspNetCore.Mvc.ViewEngines;
    
    1. In your Razor Page, add the ReportViewer control:
         <report-viewer asp-process-report="ProcessReport" 
                        asp-report-server-url="http://<report_server_url>/ReportServer"
                        asp-report-path="/<report_folder>/<report_name>"
                        width="100%"
                        height="600px">
         </report-viewer>
      
    2. Add the following action method to your Razor Page's code-behind file:
         public void ProcessReport(RenderingContext 
      
    
    

  2. Xinran Shen - MSFT 2,091 Reputation points
    2023-09-06T06:00:06.9633333+00:00

    Hi @santhosh shekar

    As far as I know, the ReportViewer apply to the ASP.NET 4.x (.NET Framework) webform application, it doesn't apply to the .NET application (.NET Core 1.0 - 3.1, .NET 5, and later versions of .NET). The difference between .NET and .NET Framework, see Choose between ASP.NET 4.x and ASP.NET Core.

    In asp.net core application, to display the SSRS reports, you can create a .NET Framework application and use a webform to display the report, then in the asp.net core application, use an Iframe tag or send http request to call the web page and get the report. Besides, you can also search some third-party package, perhaps they can help to display the SSRS reports in the asp.net core application.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,

    Xinran Shen

    0 comments No comments