What does an override application url really do?

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/WebApplication2either or http://localhostor 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/loginas 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?

+6
source share
1 answer

URL- , . URL-, . IIS , , , localhost:[PORT].

, www.myapp.com, , hosts:

127.0.0.1     www.myapp.com

, ( ), localhost .

+5

Source: https://habr.com/ru/post/1017132/


All Articles