That folder must be inside your virtual folder, so you can do:
<asp:image imageurl = "/ExternalImages/logo.jpg" runat="server">
Another option is to create a page which can read that file, so you could to write:
<asp:image imageurl = "MyImage.aspx?name=logo.jpg" runat="server">
And your MyImage.aspx.cs will look like:
protected void Page_Load(object sender, EventArgs e)
{
string basePath = @"c:\ExternalFolder";
string combined = Path.Combine(basePath, Request.QueryString["name"]);
if(!basePath.Equals(Path.GetPathRoot(combined),
StringComparison.InvariantCultureIgnoreCase))
throw new System.Security.SecurityException();
using (FileStream image = new FileStream(combined, FileMode.Open))
{
int length = (int)image.Length;
byte[] buffer = new byte[length];
image.Read(buffer, 0, length);
Response.BinaryWrite(buffer);
}
}
But note that code can lead to injection problems, as you can pass a "..\" into name
parameter and get access to files outside that folder.
So, place that folder inside your virtual directory.
EDIT: To make clear: My suggestion is to place your ExternalFolder
inside your virtual directory. That's make you life easier.
Sometimes isn't possible to move a folder. So I also updated code above to deal with non canonical file names.