Ejemplo n.º 1
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapXmlRpcRoute(name: "API", url: "{controller}");

            routes.MapRoute(
                name: "Archive",
                url: "Archive/{year}/{month}/{currentPage}/{pageSize}",
                defaults: new { controller = "Article", action = "Index", currentPage = 0, pageSize = 10 }
                );

            routes.MapRoute(
                name: "ArticleIndex",
                url: "Articles/{currentPage}/{pageSize}",
                defaults: new {controller = "Article", action = "Index", pageSize=10},
                constraints: new {currentPage = @"\d+", pageSize = @"\d+"});

            routes.MapRoute(
                name: "ArticleDetails",
                url: "Article/{id}/{slug}",
                defaults: new { controller = "Article", action = "Details" });

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Article", action = "Index", id=UrlParameter.Optional });
        }