(Note: tried to look for similar question, but the closest one doesn't seem to match my question still. i.e. MVC - Application root appears twice in url using Url.Content/Url.Action )
I currently have two ASP.NET MVC 3 RC apps running under one domain i.e.
mydomain.com/app1
mydomain.com/app2
Now, because it is a separate app, I signed up for another domain name and enabled mask forwarding to one of the apps (i.e. http://foo.com would load http://mydomain.com/app1 and in the browser, it will only show http://foo.com, not http://mydomain.com/app1)
Well, that's where MVC starts to have some complaints. Both Url.Content() & Html.Action() generate unexpected URLs.
For example, in the case of Html.Action(), if I have @Html.ActionLink("About", "Index", "About")
, I expect http://foo.com/about, but end up getting http://foo.com/app1/about
Because http://foo.com/app1/about translates into http://mydomain.com/app1/app1/about, obviously the link won't work.
Similarly, for Url.Content, if I have href="@Url.Content("~/Content/Site.css")"
, the browser will fail to load the stylesheet, because it thinks the location is at http://foo.com/app1/Content/Site.css, instead of http://foo.com/Content/Site.css
Is there a way, I can make MVC forget about its starting directory (i.e. remove "app1/" from its generated URL?)
Thanks for reading, and please let me know if additional information is needed here.