In this article I will explain with an example, how to display (show) Image from folder (directory) in RDLC Report in ASP.Net using C# and VB.Net.
This article will illustrate how to show external images to RDLC Report in ASP.Net.
The path of the external image will be dynamically set from code behind using Report parameter of the RDLC Report in ASP.Net.
 
 
Configuring the RDLC Report
1. I have already added a blank RDLC Report and an Image to the Solution folder.
Display (Show) Image from folder in RDLC Report in ASP.Net using C# and VB.Net
 
2. Now add a Parameter to the RDLC Report of type text and set its name.
Display (Show) Image from folder in RDLC Report in ASP.Net using C# and VB.Net
 
Display (Show) Image from folder in RDLC Report in ASP.Net using C# and VB.Net
 
3. Insert an Image on to the RDLC Report.
Display (Show) Image from folder in RDLC Report in ASP.Net using C# and VB.Net
 
Set its name, ToolTip to be displayed and make sure you select the Image Source as External. Next we need to set the following formula which means that path of the image will be fetched from the ImagePath Report Parameter we have added in step #2.
Display (Show) Image from folder in RDLC Report in ASP.Net using C# and VB.Net
 
=Parameters!ImagePath.Value
 
Then in the Size Tab you need to set the Display property as Original Size.
Display (Show) Image from folder in RDLC Report in ASP.Net using C# and VB.Net
 
Once image gets added you should see as below.
Display (Show) Image from folder in RDLC Report in ASP.Net using C# and VB.Net
 
 
HTML Markup
The HTML Markup consists of ASP.Net ScriptManager and ReportViewer control.
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <rsweb:ReportViewer ID="ReportViewer1" runat="server">
    </rsweb:ReportViewer>
    </form>
</body>
</html>
 
 
Namespaces
You will need to import the following namespace.
C#
using Microsoft.Reporting.WebForms;
 
VB.Net
Imports Microsoft.Reporting.WebForms
 
 
Display external image in RDLC Report
In the below code, first thing I am setting the Report Path and then the most important property EnableExternalImages has to be set to True, otherwise the image will not be shown.
Finally we need to convert the image path to File Uri and then pass as value to the ImagePath Report Parameter and pass it to the RDLC Report.
C#
protected void Page_Load(object sender, EventArgs e)
{
    if (!this.IsPostBack)
    {
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc");
        ReportViewer1.LocalReport.EnableExternalImages = true;
        string imagePath = new Uri(Server.MapPath("~/images/Mudassar.jpg")).AbsoluteUri;
        ReportParameter parameter = new ReportParameter("ImagePath", imagePath);
        ReportViewer1.LocalReport.SetParameters(parameter);
        ReportViewer1.LocalReport.Refresh();
    }
}
 
VB.Net
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
    If Not Me.IsPostBack Then
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc")
        ReportViewer1.LocalReport.EnableExternalImages = True
        Dim imagePath As String = New Uri(Server.MapPath("~/images/Mudassar.jpg")).AbsoluteUri
        Dim parameter As New ReportParameter("ImagePath", imagePath)
        ReportViewer1.LocalReport.SetParameters(parameter)
        ReportViewer1.LocalReport.Refresh()
    End If
End Sub
 
Once you execute the application you should be able to view the external image in RDLC Report as shown below.
Display (Show) Image from folder in RDLC Report in ASP.Net using C# and VB.Net
 
 
Image not visible and Cross Image appears in RDLC Report
Display (Show) Image from folder in RDLC Report in ASP.Net using C# and VB.Net
 
Now in spite of following all steps if you still do not see the report and you see a cross image icon on the RDLC Report, then you need to follow the following procedure.
You will need to make sure that either both or one of the following Handlers are added to the Web.Config file.
1. Add the following to <system.web> => <httpHandlers> section.
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
 
2. Add the following to <system.webServer> => <handlers> section.
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
 
Note: If you don’t have both sections in your Web.Config then you can add only to the one you have.
 
 
Demo
 
 
Downloads