I have an ASP.NET MVC 4 web app. It has a default home page that handles all requests to http://www.mydomain.com
as well as http://mydomain.com
. I also have an MVC Area set up that can be accessed via www.mydomain.com/Foo/Hello/
(where "Foo" is the name of the area and "Hello" is a controller in that area).
If someone makes a request to foo.mydomain.com
right now, it will route them to the default home page controller. I would like all requests to the foo subdomain root (eg. without a specific area/controller specified) to automatically be rerouted to the /foo/hello/
controller.
Additionally, I want any requests to the "Foo" Area via the www subdomain to be redirected to the "foo" subdomain. ie. I want all requests to www.mydomain.com/Foo/Goodbye
to be automatically redirected to foo.mydomain.com/Foo/Goodbye
I have, of course, looked at lots and lots of other samples/questions, but none of them seem to address my exact issue.
I'm not sure if I should solve this issue with routes, route constraints, route handlers, etc.
Additionally: this application is hosted on Windows Azure Cloud Services, so I don't have full control over IIS settings.