Hour 11. RDL file to ASP.NET
Introduction
In this article, we will see how to integrate a RDL file in ASP.Net using ReportViewer.
RDL file to ASP.Net
Step 1
- Click on the "Start" button
- Go to "All Programs"
- Expand "Visual Studio 2012"
- Click on "Visual Studio 2012"
![](https://www.csharp.com/UploadFile/Tutorial/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/visual studio 12.png)
Step 2
Click on "File", expand "New" and click on "Web Site…".
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/web%20project.png)
Step 3
Select "ASP.NET Empty Web Site" in Visual C#.
Provide a good name for the website.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/save%20name.png)
Step 4
Right-click on "SSRSWeb", select Add >> Add ASP.NET Folder >> App_Code.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/add%20new%20folder.png)
Step 5
Right-click on "SSRSWeb", select Add >> Add ASP.NET Folder >> Bin.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/bin.png)
Step 6
Right-click on "SSRSWeb", select Add >> Add New Item.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/add%20new%20item.png)
Step 7
Select "Web Form" and provide a name for it.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/web%20form%20name.png)
Step 8
Now right-click on "Bin" and click on "Add Reference".
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/add%20refrence.png)
Step 9
In Extensions, select "Microsoft.ReportViewer.WebForms" and press the "OK" button.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/extestions.png)
Step 10
Add a class inside App_Code, right-click on "App_Code" and select "Add" >> "Add New Item…".
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/reference%20folder.png)
Step 11
Select "Class" and provide it the name "ReportCredentials".
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/add%20class.png)
Step 12
This class is used to get and set the report credentials.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/code1.png)
Step 13
Inherit "IReportServerCredentials" using the namespace "Microsoft.Reporting.WebForms".
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/code%202.png)
Step 14
Create a parameterized constructor to set the credentials and also create a method to get those details.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/code3.png)
Step 15
Open "Default.aspx", drag and drop a "ReportViewer" from the toolbox under "Reporting".
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/reporting.png)
Step 16
It will add a ReportViewer control to the aspx page and also register an assembly on the top of the page.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/html.png)
Step 17
Jump to "Default.aspx.cs" and implement the following code snippet.
Here we set the credentials, ProcessingMode, ReportServerUrl and ReportPath.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/aspx.png)
Step 18
Now run the website and it asks for the ScriptManager.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/error.png)
Step 19
Add the ScriptManager from the toolbox under "AJAX Extensions" inside the form element in Default.aspx.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/script%20manager.png)
Step 20
Now run the website again.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/run.png)
Step 21
It asks us to register the web control inside the web.config under HTTP Handler.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/configuration%20error.png)
Step 22
Copy the details from the preceding error and paste them under HttpHandler inside web.config.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/web%20config.png)
Step 23
Now run the website and we can see the report in Default.aspx using the Report Viewer.
![](https://www.csharp.com/admin/step-by-step-ssrs-in-11-hours-hour-1101092019123841/Images/output.png)
Author
Akshay Patel
58
28.6k
7.7m