I am not sure the best way to architect my IIS environment and MVC4 applications.
I have my standard marketing site on www.mydomain.com . This is an mvc4 site.
I have created a 2nd mvc4 application that I want users to be able to access via www.theircompanyname.mydomain.com
I dont want to have to hardcode any subdomains as I need this to be as flexible as possible.
Can anyone suggest what I should be doing?
preguntado el 10 de marzo de 12 a las 06:03
You are looking for a multitenant application, varied on the subdomain.
You can simply pull the correct record from a data source of sorts based on the current subdomain.
Also, for ease of routing and building links, I'd recommend building a new RouteBase subclassed type, that once initialized with the route, would have the subdomain and the referenced client Identifier as a route parameter in the RouteData.Values collection.
This article talks about subclassing RouteBase for a subdomain: ¿Cómo hacer cuentas al estilo Basecamp en Asp.Net Mvc?
This stackoverflow.com post has a wealth of links regarding multitenancy: ¿Qué se debe tener en cuenta al desarrollar una aplicación MVC de asp.net multiinquilino?