Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

path mapping using "~"

Status
Not open for further replies.

Zarcom

Programmer
May 7, 2002
1,275
0
0
CA
Hey guys got a simple question here. I downloaded the asp.net portal sample from In the sample the paths to the different controls and pictures all seem to be declare using a ~ like so "~/images/image.gif" Looking at the directory structure I surmised that this goes up a level and then follows the path from there. I was wondering then what the diffence between "~" and ".." is.
Thanks for your time That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
The ~ is a reference to the virtual root of the web application.

In contract, / marks the root of the website.

So if you have a website named it doesn't matter if you use ~/images/image.gif or just /images/image.gif.

However, If your web has subsites, e.g. and you have a web.config in (and you have defined whatever as a web application), the ~/images/image.gif resolves to
The ~ is very handy if you happen to have multiple projects on your site. As long as you use ~ in the paths of your web controls (it doesn't work in plain html, unfortunately), you can easily move your application from a subapplication to a production server (where the whatever app get deployed to
Again, it is just a reference to your application root.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top