Hello I want to build a MVC3 app, which can handle simple and subdomain request. The problem is with the Routing setup, and generation of correct paths inside native mvc3 Html extensions ( ActionLinks, Url.Content, Html.BeginForm, Ajax.BeginForm )
So.. I have the following structure:
myDomain.com // HomeController
|
Bar.myDomain.com <------|-------> Foo.myDomain.com
// BarController // FooController
The HomeController, is mapped to myDomain.com whose routes should look like:
myDomain.com // myDomain.com/{controller}/{action} -- with defaults
myDomain.com/Home/Index // myDomain.com/{controller}/{action}
myDomain.com/Home/Index/Id // myDomain.com/{controller}/{action}/{id}
myDomain.com/en/Home/Index // myDomain.com/{language}/{controller}/{action}
myDomain.com/en/Home/Index/Id // myDomain.com/{language}/{controller}/{action}/{id}
The BarController, is mapped to Bar.myDomain.com with routes:
Bar.myDomain.com // {Controller}.myDomain.com/{action} -- with defaults
Bar.myDomain.com/Index // {Controller}.myDomain.com/{action}
Bar.myDomain.com/Index/Id // {Controller}.myDomain.com/{action}/{id}
Bar.myDomain.com/en/Index // {Controller}.myDomain.com/{language}/{action}
Bar.myDomain.com/en/Index/Id // {Controller}.myDomain.com/{language}/{action}/{id}
FooController is the same as BarController
THE PROBLEM:
All the HtmlHelpers for the subdomain request's are generating path's like:
href="Bar.myDomain.com/en/Bar/Index"
href="Bar.myDomain.com/Bar/Index"
instead of:
href="Bar.myDomain.com/en/Index"
href="Bar.myDomain.com/Index"
Where and how to control the path, in accordance with it's route.
Note 1.: The URL in the AdressBar is generated OK. The problem is only with the path.
Note 2.: Please focus on IIS 7.0 integrated pipeline
Note 3.: My source of inspiration is from --->> Here
Thank you!