开发者

What is the difference between these two Html statements?

What is the difference between these two Html statements.

<asp:Image runat="server" ID="imgHelp"  ImageUrl="~/images/help.gif" />

&

<asp:Image开发者_JS百科 runat="server" ID="imgHelp"  ImageUrl="/images/help.gif" />


One image path is absolute (~/images/help.gif) and one is relative (/images/help.gif)


Their path to image differs.

This one is a nice overview of how to handle asp.net paths:

~/ Root Relative Paths and ResolveUrl() and ResolveClientUrl()

ASP.NET supports root-relative virtual path syntax in most of its URL properties in Web Forms.
So you can easily specify a root relative path in a control rather than a location relative path:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜