The difference between a virtual path tilde ~ and a slash/

Source: Internet
Author: User

/is the website root directory, ~/is the ASP. Application root directory ... The two are completely different concepts.

The path resolution for "~/" is somewhat special for ASP. It searches the root directory until it matches the directory you specify.

Like what:
Virtual Directory mapping: C:\inetpub\wwwroot\MySite
Then: "/" corresponds to MySite this directory
When you write/1.jpg, then the net will only go to MySite, that is, to find whether mysite/1.jpg exist.
When you write ~/1.jpg, then ASP. NET will look for 1.jpg under the whole MySite, even if
The actual path can also be found in C:\intepub\wwwroot\MySite\images\1.jpg.

In addition, you can use the ~/path representation only for server-side controls.

The difference between a virtual path tilde ~ and a slash/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.