Marek
Marek

Reputation: 10402

How to serve multiple domains with a single ASP.NET MVC application?

How to implement a mechanism (within a single ASP.NET MVC application) to ensure that:

(the domains are aliased to the same web hosting)

What extension points within ASP.NET MVC should I use to ensure that the described mechanism works?

Upvotes: 3

Views: 1550

Answers (2)

Adrian Grigore
Adrian Grigore

Reputation: 33318

I think you could implement a IRouteConstraint descendant that analyzes the current HttpContext and matches (or does not match) a route depending on the domain requested. Then have two different default routes in your Global.asax file, each with different constraints.

I would still prefer two applications, but it's your choice of course.

Upvotes: 1

chris166
chris166

Reputation: 4807

Why not set up 2 web applications that share common code in a DLL? Each web app would be a standard MVC application.

Upvotes: 0

Related Questions