1

I have a C# MVC application hosted on apps.server.com/appname but I have a URL rewrite being done on my company's F5 that makes that application visible to www.server.com/apps/appname. Now when I navigate to that url no images or links work because they are all pointing to www.server.com/appname when using @Url.Content("~/URL"). What do I need to do for all of my helper classes to know that I am under an aliased URL instead of where it thinks it is (ie, the apps.server.com URL)?

tereško
  • 58,060
  • 25
  • 98
  • 150
snoluet
  • 181
  • 1
  • 1
  • 10
  • It's usually better, if there some form of re-write happening, to let the re-writer handle modifying the response also, rather than doing half of the re-writing in the re-writer, and half in your application. – Damien_The_Unbeliever Aug 24 '12 at 07:53

1 Answers1

1

If you are running in IIS 7 Integrated Pipeline mode try putting the following in your Global.asax:

protected void Application_BeginRequest(object sender, EventArgs e)
{
    Request.ServerVariables.Remove("IIS_WasUrlRewritten");
}
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928