路由配置

路由约束:正则表达式

constraints

 routes.MapRoute(
                name: "Default2",
                url: "gz-{controller}/{action}/{name}/{id}",
                defaults: new { controller = "Home", action = "HtmlHelper"},
                constraints: new { id="[0-9]+" }//路由约束

          namespaces: new string[1] { "S01Annotation.Controllers" }//去指定的命名空间查找方法
);
原文地址:https://www.cnblogs.com/huanglexian/p/3637470.html