这是注册的规则
Code
//大类映射地址
routes.MapRoute(
"ParentCategory",
"{ParentTag}",
new { controller = "category", action = "index", parentTag = "" },
new { parentTag = "[a-zA-Z]+" }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
我想这样放大类,不改动{parentTag}
但是当我访问一个目录的时候如 /Admin 也跳到上面去了
由于目录较多不可能为每个目录添加映射规则啊
求助啊!1
这个好像没法实现,不过你可以加个固定的字符串
比如
routes.MapRoute(
"ParentCategory",
"@{ParentTag}",
new { controller = "category", action = "index", parentTag = "" },
new { parentTag = "[a-zA-Z]+" }
);