我有以下路线:
routes.MapRoute(
"SetPassword",
"Account/SetPassword/{token}",
new { controller = "Account", action = "SetPassword" }
);
我希望令牌是强制性的。但问题是,如果令牌丢失,路由会退回到默认值:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
404 Not Found
如果有人输入
http://mysite.com/Account/SetPassword 之类的地址,我想要返回
如果控制器和操作名称与规范匹配,我如何指定令牌是强制参数并且路由必须在此路由处停止?