I have an image that I want to use it's src attribute in relative format
when my website URL was http://localhost/
I used to use this code to access this image file:
<img alt="something" src="/Files/pic.png">
But now I have to add an application to my site and change my site URL to http://localhost/mysite
.
Now none of my images load in this site because the path is still http://localhost/Files/pic.png
not http://localhost/mysite/Files/pic.png
how can I change my root URL (/
) to http://localhost/mysite/
?
Thanks
You can use ~ symbol to represent root in ASP.Net
Use tilde
~
in a server control to use a relative path.@rrrr is right, that the way to do it,
but I would use a standard html image with runat="server"
Reason : less server side controls