How To Get URL To Root Of Web Application?
Character ~ (tilde) represents the root of the web application folder. You can use this HTML code to make link to home page:
<a href="~/" runat="server">Home Page</a>
Note that you must have runat="server" to make this works.
This facility is very useful when you develop web application on localhost because you can avoid ugly URL like href="/YourWebApplicationName/".
Instead of tilde (~) character, you can use it encoded as %7e, so the code will be:
<a href="%7e/" runat="server">Home Page</a>
Related articles:
1. Cascaded Style Sheets (CSS) in ASP.NET Web applications
2. Unlimited Income Potential
Copyright © 2002-2008 Bean Software. All rights reserved.