如何實現屬性路由
啟用屬性路由要啟用屬性路由,請在配置期間呼叫 MapMvcAttributeRoutes。
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”);
routes.MapMvcAttributeRoutes();
routes.MapRoute(
name: `Default`,
url: “{controller}/{action}/{id}”,
defaults: new { controller = `Home`, action = `Index`, id = UrlParameter.Optional }
);
}