How do I generate friendly URLs within the ASP.NET MVC Framework? For example, we\'ve got a URL that looks like this:
http://site/catalogue/BrowseByStyleLevel/1
This is how I have implemented the slug URL on my application. Note: The default Maproute should not be changed and also the routes are processed in the order in which they're added to the route list.
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home",
action = "Index",
id = UrlParameter.Optional
} // Parameter defaults
);
routes.MapRoute("Place", "{controller}/{action}/{id}/{slug}", new { controller = "Place", action = "Details", id = UrlParameter.Optional,slug="" });