public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");ide
routes.MapRoute(
"Default", // 路由名稱
"{controller}/{action}/{id}", // 帶有參數的 URL
new { controller = "Home", action = "Index", id = UrlParameter.Optional },// 參數默認值
new string[] { "MvcApplication1.Controllers" }
);spa
}路由
區域路由string
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Admin_default",
"Admin/{controller}/{action}/{id}",
new {controller="Home", action = "Index", id = UrlParameter.Optional },
new string[] { "MvcApplication1.Areas.Admin.Controllers" }
);
}io