Well, in my experience the ~ resolves exactly like you need, to / (if your
project is the default site) or to /yourProjectName/ (if it is a
sub-directory).
This is a runtime resolution, so if you move the site, it will still work. I
HAVE seen some weird things with rendering of ~ in FireFox in (forexample)
the NavigateUrl
property of the HyperLink control (why, i dont know, never bothered to debug
for firefox). That was 2003 though, havent tried to recreate in 2005.
For html elements such as images, it is actually pretty easy to work
around.... you could do one of two things....
write your image as either of the following:
<asp:image id=myImage runat=server imageurl="~/images/myImage.gif" />
or
<img src='<%= ResolveUrl("~/images/myImage.gif") %>' />
As a result of the ASP/FireFox rendering bug above, i have some code which
dynamically generates the full url for the approot
(essentially the same idea as ResolveUrl("~")). If you would like that code,
email me, and ill send you the code,
but like i said above, it may not be necessary anymore in 2005.