How to use a SubDomain as Route Value in MVC2 
first:

I did read and tried to implemented [this][1] and [this][2] and [that][3], but I failed completely :(

my route is like:

    routes.MapRoute(
        "DefaultRoute",
        "{calurl}/{controller}/{action}/{id}",
        new { calurl = "none", controller = "Subscriber", action = "Index", id = UrlParameter.Optional }
    );

and I'm trying to use as

    "{calurl}.domain.com",
    "{controller}/{action}/{id}"

so the routed value `calurl` would always come from the subdomain.

and I could have links like:

    http://demo.domain.com/Subscriber/Register

as of today I have

    http://domain.com/demo/Subscriber/Register

***

**What I have tried**


I tried to create my own `CustomRoute` using the example of the links above (all 3, one at a time), and I end up always screwing everything.

and I'm keep thinking that it's to much code just to change `RouteValue["calurl"]` to the subdomain.


> What/How can I do this?




  [1]: http://stackoverflow.com/questions/278668
  [2]: http://hanssens.org/post/ASPNET-MVC-Subdomain-Routing.aspx
  [3]: http://blog.maartenballiauw.be/post/2009/05/20/ASPNET-MVC-Domain-Routing.aspx
How to use a SubDomain as Route Value in MVC2 
===

first:

I did read and tried to implemented [this][1] and [this][2] and [that][3], but I failed completely :(

my route is like:

    routes.MapRoute(
        "DefaultRoute",
        "{calurl}/{controller}/{action}/{id}",
        new { calurl = "none", controller = "Subscriber", action = "Index", id = UrlParameter.Optional }
    );

and I'm trying to use as

    "{calurl}.domain.com",
    "{controller}/{action}/{id}"

so the routed value `calurl` would always come from the subdomain.

and I could have links like:

    http://demo.domain.com/Subscriber/Register

as of today I have

    http://domain.com/demo/Subscriber/Register

***

**What I have tried**


I tried to create my own `CustomRoute` using the example of the links above (all 3, one at a time), and I end up always screwing everything.

and I'm keep thinking that it's to much code just to change `RouteValue["calurl"]` to the subdomain.


> What/How can I do this?




  [1]: http://stackoverflow.com/questions/278668
  [2]: http://hanssens.org/post/ASPNET-MVC-Subdomain-Routing.aspx
  [3]: http://blog.maartenballiauw.be/post/2009/05/20/ASPNET-MVC-Domain-Routing.aspx