Whether we want to reference resource website, or do the redirect, unless external resources, or use a relative path is definitely preferable, in the world of ASP.NET which we used to express the root of people will use /(Slash)
, someone will use ~/(Tilde Slash)
, but they are two differences in what?
Announced the answer, /
on behalf of the site's root directory, ~/
on behalf of the application root directory, I use examples to illustrate broke under my IIS website, and instance path points to a Web site with ASP.NET MVC applications.
When I browse my home forcibly redirected to the login page, use / with ~ / test to see both.
The test result is "no difference" can properly be redirected to the login page.
Then I add a website under the abc
application instance path pointing to the same site with the application.
This time / with ~ / have differences, we will find - browse abc / abc is oriented login page.
Dry programming this line encountered the same problem but different solution, but do not know why that is, for himself planted a landmine in the future, when it will step on the self-destruct do not know.
Resources
- slash(/) vs tilde slash (~/) in style sheet path in asp.net
Original: Large column [breeze] relative path of ASP.NET / (Slash) difference with ~ / (Tilde Slash) of