[Solved] ASP.Net Error: Report contains external images. The EnableExternalImages property has not been set for this report

kankon
 
on Feb 13, 2021 03:44 AM
4801 Views

hello,

Display image from session to report viewer in ASP.Net

I am trying display image from session to report viewer

Session["filelocation"] = im1.ImageUrl;

the image working in second page i can see it in second page

Image1.ImageUrl = Session["filelocation"].ToString();

 but with report viewer not display

param[7] = new ReportParameter("imagesbarcode", Image1.ImageUrl);

I am insert image then image propeties image source

add : =Parameters!imagesbarcode.Value

also in parameters add : imagesbarcode

if i select external  i get  error

Report 'Report3' contains external images. The EnableExternalImages property has not been set for this report.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Microsoft.Reporting.WebForms.ReportSecurityException: Report 'Report3' contains external images. The EnableExternalImages property has not been set for this report. Source Error:

Line 61:      param[7] = new ReportParameter("imagesbarcode", Image1.ToolTip);
Line 62: 
Line 63:      ReportViewer1.LocalReport.SetParameters(param);
Line 64: 
Line 65:      ReportViewer1.LocalReport.DataSources.Clear();

Source File: E:\My Project\gsc\gsc\Admin\rasmi.aspx.cs    Line: 63 Stack Trace:

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Feb 13, 2021 04:07 AM
kankon says:
param[7] = new ReportParameter("imagesbarcode", Image1.ImageUrl);

Use below code. You need to pass only the base64String to the parameter.

param[7] = new ReportParameter("imagesbarcode", Image1.ImageUrl.Replace("data:image/png;base64,", ""));