I have a rather simple task, retrieving an image file from a virtual folder outside of my ASP.Net web Application (The Virtual Folder is in the root of the website) and then displaying it in an image control. I am able to to access a Virtual Folder that is within the web site. Here is my code that
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim sourcefile As String = Server.MapPath("~/Common/Images/LAPDPatch.jpg")
Image1.ImageUrl = sourcefile
End Sub
What am I doing wrong?
Ok, I was able to figure it out:
Solution
Ok, I was able to get it working, I was using the wrong “slash” character I was using the forward slash instead of the back slash:
Dim sourcefile As String = Server.MapPath("\VitualFolderName\") & "Images\LAPDPatch.jpg"
Thanks to all who responded!
Use
ResolveUrl: