I´m creating a result pool, where depending on the query string, the page loads the image. I have the following object
<li class="labelForm"><asp:Image ID="imgImagen" runat="server" /></li>
on the page_load event i got:
string path = res == "OK" ? (Server.MapPath("~/Images/Results/OK/")) : (Server.MapPath("~/Images/Results/NO/"));
path = App_Code.FilePicker.FilePicker(path);
imgImagen.ImageUrl = path;
The image route is a valid one. I tested it on the browser and the explorer
D:\Proyectos Web Forms\MyPage\MyPage\Images\Results\OK\thumbsUp2.jpg
Since the code is running on the Page_Load event (way before render event), it shouldn’t be the problem, and the file route is valid. However, the browser displays a little icon of empty image.
What could I be missing?
I was using absolute routes, instead of a relative route. Instead of this:
"D:\\Proyectos Web Forms\\MyPage\\MyPage\\Images\\Results\\OK\\thumbsUp2.jpg"Should be this:
"~/Images/Results/OK/thumbsUp2.jpg"