I have an application in iis available as http://localhost/app/ which means that all relative links created by UrlHelper are resolved as http://localhost/app/???.
Example:
Url.Content("~/images/background.png") resolves into /app/images/background.png
Now the problem is that ISA server adds prefix to the application, so that application is available from outside as http://foo.com/prefix/app/???
Now mvc will handle the request correctly, because it still thinks that the request path is just /app/???, but it won’t generate links with that prefix when using UrlHelper.
So the question is – is there any way to tell MVC to generate links with different virtual path than is defined in iis?
Example:
Url.Content("~/images/background.png") should resolve into /prefix/app/images/background.png
I really don’t want to create own UrlHelper extensions because that won’t affect stuff like Html.ActionLink or RedirectToAction.
You may need to get to the Request Context and modify the URL early in the request pipeline so that by the time UrlHelper fires, Request.RawUrl returns proper path with the prefix. Great question as I will try to come up with a logic sometime soon.