SQLTeam.com | Weblogs | Forums

Reporting external image show only red X

I know I at the complete wrong forum. I have tried all other avenues and are completely stumped. I am using external images in a report, when I run the report however I end up with a red X in stead of the image.

I am using the following code :

Imports Microsoft.Reporting.WinForms

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.ReportViewer1.LocalReport.ReportPath =      "C:\Users\Administrator\Desktop\Trash\WindowsApplication50\WindowsApplication50\Report1.rdlc"

    Dim param1 As ReportParameter
    param1 = New ReportParameter("ReportParameter1", "File:/// " + "C:\Users\Administrator\Desktop\SKEDULERING\Grafieka\Plaaskaarte\8425.tif", True)
    Me.ReportViewer1.LocalReport.EnableExternalImages = True
    Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter() {param1})


End Sub

End Class

Any help would be greatly appreciated. Could it be that my report configurations is not correctly set up?


I reckon that

"File:/// " + "C:\Users\Administrator\Desktop\SKEDULERING\Grafieka\Plaaskaarte\8425.tif"

will cause the browser to look on the USER'S C: drive. (Might also be a problem with mix of Forward / Back Slashes)

For a website you generally need to store the images somewhere under root folder, or "map" a virtual folder in order to reference the images outside the root folder tree (and then will probably also need to set a CONFIG to enable Parent Paths or somesuch (i.e. security override)

Kristen thank you for replying. This is a windows application. What do you mean with "will cause the browser to look on the USER'S C: drive"? I thought that is exactly what the application should do ? I have tried changing the back \ to all forward /. Nothing changes.

I presumed that the Browser should be referencing the images from the SERVER, and thus the FILE:// path should be a drive/path RELATEIVE to the server.

If indeed the images are present on the C: drive of EVERYONE who will use this routine then the Browser should indeed be able to find them. (In fact now I think about it more carefully you use of "FILE:///" does indeed imply that you want the browser to look on the local C: drive)

You could test that by just putting


in the Browser/s address bar and seeing if it finds the image, or not. If not then modify the File URI in the address bar until you are able to display the image, and then retro-apply that to your code