Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // should allow routing to /Article/article-title type URL using the Index view in the specified Controller
  2. // Example URL: /Article/tweaking-asp.net-identity-to-add-first-and-last-name-as-username
  3.  
  4. public class RouteConfig
  5. {
  6.     public static void RegisterRoutes(RouteCollection routes)
  7.     {
  8.         routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  9.  
  10.         // Intent is to set up a route for ~/Article/{slug}
  11.         // where {slug} represents the url-friendly version of the article title
  12.         routes.MapRoute(
  13.             name: "Articles",
  14.             url: "Article/{*slug}",
  15.             defaults: new { controller = "Article", action = "Index", slug = UrlParameter.Optional }
  16.         );
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement