I have the code in my Helper.cs like below:
public static string NoImagePath { get { return "file:///W:/images/noimage.png"; } }
In the view :
<% if (!string.IsNullOrEmpty(Model.Item[i].PictureName)){ %>
<img width="135px" height="100px" src="<%: HelperClass.CheckImageUrlExist(Model.Item[i].PictureName)%>" alt="<%: Model.Item[i].Name %>" />
<%}else{ %>
<img width="135px" height="100px" src="<%:HelperClass.NoImagePath %>" alt="No Image"/>
<%} %>
All these images can display only in IE but the other browsers like mozilla firefox, chrome .. cannot. Anyone can solve this issue?
Thank.
Use a relative path. Most browsers don’t support the
file://URI due to security reasons (Google it, I’m too lazy to link), so if you place your images into a folder and reference them absolutely or relatively, the HTML should render fine in all browsers.