下面是定义的路由匹配规则:
routes.MapRoute(
                    name: "UnsolvedTagspecial",
                    template: "user/undo/{t}",
                    defaults: new { Controller = "user", action = "undo" }
                    );
routes.MapRoute(
                    name: "UnsolvedTag",
                    template: "user/{t}/undo",
                    defaults: new { Controller = "user", action = "undo" }
                    );
下面是Controller 中的方法
public async Task<ActionResult> undo(string t)
{
    //   .....
}
我在地址栏上输入 :http://localhost:111/user/undo/111 设置断点在方法中,查看到 t 为null,
然而我输入:http://localhost:111/user/111/undo 在方法中成功接收到参数 t = 111
这是为什么呀?
找到问题原因了,原因是我把默认的路由定义规则放在了开头,好尴尬。
routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "list", action = "unsolved", id = UrlParameter.Optional } // Parameter defaults
            );
只要把这段默认的路由规则放在最后就成功解决了上面的问题。