1

I'm managing a portal type website where authenticated users have an individualized 'homepage'.

http://www.myWebSite.com/MyHomePage

I'd like to understand how to implement that same functionality to a subdomain name:

http://MyHomePage.myWebsite.com

So requests that come via the MyHomePage subdomain will authenticate the user and then render the same page as if they used the longer URL: http://www.myWebSite.com/MyHomePage

thx

justSteve
  • 5,444
  • 19
  • 72
  • 137

2 Answers2

1

Create a new class called YourDomainRoute that inherits Route and simply convert the sub domain to a controller name (or whatever you like) in the GetRouteData() method.

You also need to override GetVirtualPath() if you want @Html.ActionLink etc to automatically use your custom route.

jgauffin
  • 99,844
  • 45
  • 235
  • 372
0

You would do this with a custom RouteHandler. See Here.

There is also a similar blog post by Tony Williams for MVC 2 (it should still apply)

Community
  • 1
  • 1
Ethan Cabiac
  • 4,943
  • 20
  • 36