Bri*_*per 8 asp.net asp.net-mvc routing asp.net-routing asp.net-mvc-routing
我有这样的路线:
routes.MapRoute
(
"Profile",
"profile/{username}",
new { controller = "Profile", action = "Index" },
new { username = @"^(getmoreactivity)" }
);
Run Code Online (Sandbox Code Playgroud)
这适用于所有用户,但我有一种情况,我想要针对getmoreactivity点击一个动作.所以我想制定这个约束来说明当用户名不是getmoreactivity时.它只是没有工作.
我坚持使用RouteDebugger并尝试@"[^(getmoreactivity)]"@"^^(getmoreactivity)"@"^ getmoreactivity"@"[^ getmoreactivity]".好吧,我尝试了无数的东西,但没有解决我的问题.
你到底怎么对整个单词施加NOT约束?
Lee*_*unn 19
尝试:
routes.MapRoute
(
"Profile",
"profile/{username}",
new { controller = "Profile", action = "Index" },
new { username = "(?!getmoreactivity).*" }
);
Run Code Online (Sandbox Code Playgroud)
?!是一个先行:http://www.regular-expressions.info/refadv.html
......
| 归档时间: |
|
| 查看次数: |
4105 次 |
| 最近记录: |