I've this routing map:
routes.MapRoute(
"ViewNews",
"{controller}/{action}/{id}/{title}",
new { controller = "Home", action = "NewsDetail", id = "", title = "" }
);
and this ActionLink in my View:
@Html.ActionLink(Model.Title, "NewsDetail", new { id = Model.Id, title = Url.ToFriendlyUrl(Model.Title) })
I expect it renders something like this:
http://localhost:49327/Home/NewsDetail/1/news-title
instead it renders:
http://localhost:49327/Home/NewsDetail/1?title=news-title
what I miss?
Update
I've moved MapRoute before default in this way:
routes.MapRoute(
"ViewNews",
"{controller}/{action}/{id}/{title}",
new { controller = "Home", action = "NewsDetail", id = "", title = "" }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}", // URL with parameters
new { controller = "Home", action = "Index" } // Parameter defaults
);
but now when I request the initial URL:
http://localhost:49327/Home
I get instantly redirected to:
http://localhost:49327/Home/NewsDetail/1/news-title
"NewsDetail" has become the default action!
