I want to have on my existing IIS web site an additional host header that will always redirect url's that come in with that domain to a specific mvc razor view page. I've updated my global.asax as follows which kind of works but feels awkward and changes the URL to show the new URL which I don't want.
That is, I want all reqeusts that come in on the domain foo.org to redirect to the view /giving/svccgiving and for the users browser to continue to say foo.org
Here is the code I tried that partially works. any better suggestions?
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (Request.Url.AbsoluteUri.ToLower().Contains("foo.org") &&
!Request.Url.AbsoluteUri.ToLower().Contains("giving/svccgiving"))
{
Response.Redirect("~/Giving/SVCCGiving");
}
}