MVC routing problems - url generation

Posted by roncansan on Stack Overflow See other posts from Stack Overflow or by roncansan
Published on 2010-12-30T15:21:10Z Indexed on 2010/12/30 15:53 UTC
Read the original article Hit count: 284

Hi,

I what to create a url that looks like website.com/sea/season/23/team

Here is the MapRoute

routes.MapRoute(
  "SeaTeam", 
  "sea/season/{seasonId}/team/{action}/{name}", 
  new { controller = "Team", action = "Index", name = UrlParameter.Optional} 
); 

The Html.ActionLink looks like

@Html.ActionLink("Add Team", "Index", "SeaTeam", new { seasonId = seasons.id }, null)

But its generating the following url

<a href="/SeaTeam?seasonId=1">Add Team</a>

Any insights? Thanks...

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about asp.net-mvc-routing