The only place on the whole Internet I could find an explanation on MSDN :
Specifies an alternate path for the root URL of the application. Use this if the root of the web application is not the root of your project.
From here, I realized that the “application root” is the path that is extracted when using the tilde in ASP.NET. Therefore, I would expect that if I go to the properties of the project - Web - "redefine the root of the application" and specify a different URL, then the tilde will be mapped to this URL.
But this is not so. For example, my website is located in a virtual directory - http://localhost/WebApplication1
and "Override Application Root". I am trying to specify http://localhost/WebApplication2
either or http://localhost
or http://WebApplication2
(which all exist on my local IIS). Now when i write
Response.Redirect("~/test2/login");
I expect it to redirect me to http://localhost/WebApplication2/test2/login
. But instead, it redirects me to http://localhost/WebApplication1/test2/login
as if I were not redefining the "application root".
So what does this function really have to do? Or maybe it does not work, because I missed something and did not determine it correctly?
source
share