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)?

1
  • 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. Commented Aug 24, 2012 at 7:53

1 Answer 1

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");
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.