How can we make an ASP.NET MVC4 route that uses subdomain information to determine its route? For example:
website1.domain.com
goes to domain.com\
ASP.NET's built-in routing doesn't directly support sub-domain routing. But fortunately, there's AttributeRouting, which is a very popular add-on library for routing that allows you to do lots of fancy routing, including sub-domain routing.
Here's an example from the Attribute Routing site:
[RouteArea("Users", Subdomain = "users")]
public class SubdomainController : Controller
{
[GET("")]
public ActionResult Index() { /* ... */ }
}