ASP.NET MVC 3 Route Breaks ActionLink Functionality

I have MVC 2, which I migrated to MVC 3. After the migration, none of my ActionLinks worked anymore. I found this because of my default route.

routes.MapRoute( "Default", "{controller}/{action}/{id}/{title}", new { controller = "Home", action = "Index", id = UrlParameter.Optional, title = UrlParameter.Optional } );

If I changed the default route to the default MVC route, it works fine again.

routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional } );

Why does an optional header parameter break my ActionLinks?

+3
source share
2 answers

, , . id . , ASP.NET MVC 3. .

, , , id :

@Html.ActionLink("text", "Index", new { id = "123" })
+2

Source: https://habr.com/ru/post/1792438/


All Articles