How can I create a dynamic url to display an image?
I am creating a web page that lists search results of products and their associated images.
I tried using Url.Content, but it does not format the url correctly.
Code I created:
<img src="../../Images/<%: product.PicFileName %>" alt="photo" />
Html that was output:
<img src=".. ..="" Images="" nopic.jpg="" alt="photo" ="">
I also tried creating a helper method but it created the exact same output:
public static string GetPicUrl(string picFileName)
{
string picUrl = "../../" + picFileName;
return picUrl;
}