tags:

views:

50

answers:

0

I use ASP.NET MVC 2 beta on VS2008. I also use Maarten Balliauw's excellent Domain Routing code to handle incoming routes of the form {id}.example.com/{action}. However, I can't get it to create outgoing routes of this form. In general, should this be possible?

If you're familiar with Maarten's code, here's what I'm trying. By the way, he has his own Html.ActionLink extension methods, which I'm using:

Home/Index.aspx View:

<%=Html.ActionLink("bar link", "DomainRouteCheck", new {id = "bar"}, true) %>

Global.asax:

routes.Add("DomainRoute", new DomainRoute(
           "{id}.example.com:8080",        // Domain with parameters
           "{action}",                     // URL with parameters
           new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
));

HomeController.cs:

public ActionResult DomainRouteCheck(string id)
{
     ViewData["foo"] = id;
     return View();
}