例子引入
先看看如下例子,你能完全明白吗?
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.Mvc; 6 using System.Web.Routing; 7 8 namespace MVCDemo 9 {10 public class RouteConfig11 {12 public static void RegisterRoutes(RouteCollection routes)13 {14 routes.MapMvcAttributeRoutes();//特性路由15 16 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");//忽略资源文件17 18 routes.MapRoute(19 name: "Default",//路由名,唯一20 url: "{controller}/{action}/{id}",//路由URL21 defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },//路由URL默认值22 namespaces: new[] {&nbs