Reputation: 5524
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
Upvotes: 1
Views: 533
Reputation: 101130
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.
Upvotes: 1
Reputation: 4993
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)
Upvotes: 0