Quick Virtual Path Tip
In ASP.net server controls you can specify page addresses using the tilde (~) character to specify a path from the root of the current web application.
Imagine you have a site mounted on your local machine under a virtual directory called 'foo'. To access the homepage, you would go to http://localhost/foo/default.aspx. In a server control within the site, I could reference '~/default.aspx' to link to the home page, but I can't write that out as a URL - the magic of server controls in ASP.net transforms the virtual path to the correct url.
The neat thing about this is that then the same site could be mounted under a different virtual directory (or at the root of the site) and ASP.net would still translate it directly.
But what if you aren't inside a server control but want to do the same thing?
In the above example, we can do this:
System.Web.VirtualPathUtility.ToAbsolute("~/default.aspx")
The returned string from this method is '/foo/default.aspx'. w00t!