1

I have domain domain1.com with an alias domain2.com.

How I can change the location of views for domain2.com?

I want the default pages:

  • for domain1 to be webhosting disk/Content/Views/Index.cshtml
  • for domain2 to be webhosting disk/Content/Views/Domain2/Index.cshtml

How can this be implemented via global.asax and an MVC route?

p.campbell
  • 98,673
  • 67
  • 256
  • 322
David Horák
  • 5,535
  • 10
  • 53
  • 77

2 Answers2

0

Is there a reason why they can't be two sites? They can still be hosted on the same server with same ip using hostheaders.

You can extend the Razor View Engine. This is an example extending the view engine to dynamically determining the view path.

Dallas
  • 2,217
  • 1
  • 13
  • 13
0

Seems simple enough: write a domain aware ViewEngine. I'd recommend, however, abstracting out the logic of determining when/how to switch view into it's own interface; that way if you you decide to switch view on a cookie value, instead of URL, you can easily do so.

Esteban Araya
  • 29,284
  • 24
  • 107
  • 141