This question should be answered in somewhere, but I'll try to explain the scenario:
I have an application ASP.NET MVC, that works fine when I debug it locally OR deploying in Root IIS, but if I deploy it as an application on IIS (using alias), all referenced files will point to wrong place.
I'm using (for testing) my local machine as web server. By default, the application redirects to application/Login address.
Examples:
1) If I deploy the application in C:\inetpub\wwwroot, and access it via URL http://localhost, the website works fine, there is no file break or whatever. The website redirects the user to page http://localhost/Login
2) If I deploy the application in C:\inetpub\wwwroot\app1, and access it via URL http://localhost/app1, all referenced link and redirects are linking to http://localhost instead of http://localhost/app1, and when the default redirect occurs, it redirects me to http://localhost/Login, instead of http://localhost/app1/Login.
I tried to use the resource "location" on Web.config, setting the path to ".", "~" (that crashed the application) and "/", setting the inheritInChildApplications to true/false, setting this at one node above System.web node, but none of these attempts worked to me.
And it's no use setting the redirect to Login on RouteConfig, because it will solve only the Login redirect problem, but not the whole problem. Consider that the BundleConfig is reading in the same way.
I left the system.web node in Web.config node like this:
<location path="." inheritInChildApplications="false">
<system.web>
<authentication mode="Forms">
<forms loginUrl="~/Login" timeout="60" />
</authentication>
<roleManager enabled="true">
</roleManager>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
</system.web>