Hello,
Can someone tell me where the following tag should be pointing to?
<asp:Image runat="server" ImageUrl="~/images/logo.gif" />
It renders in IE and FF as
<img src="images/logo.gif" ....>
I was expecting something like this
<img src="/cart/images/logo.gif" ....>
/cart is my virtual application root.
TIA
Hi Danny
Unless you state the path of the page containing the url no one can
predict specifically what the result will be.
For example if the site relative address of the page was /cart/
Apage.aspx then the result will be as already shown. If it was say /
cart/Afolder/Apage.aspx then the result will be ../images/logo.gif.
I must also stress that it is the server that does the translation of
application relative addresses (those using the ~ character) not the
browser, so it wont make any difference which browser you use. The ~
symbol would not be recognised on the client (besides the browser has
no way of knowing where in the full url the application root is). The
server replaces ~ with a normal W3C compliant relative address when
rendering the page (as in my exampe).
On receipt of a relative address the browser reconstructs the full
path based on the url of the requested page. So, for example, if
http://yourdomain.com/cart/Afolder/Apage.aspx returned an image with
an src="../images/logo.gif" it would send a request for the image file
to
http://yourdomain.com/cart/images/logo.gif
HTH