我想使用ASP.NET路由生成路由,但我只希望它應用如果某些值是數字。ASP.NET路由 - 僅在數字時才添加路由?
// Routing for Archive Pages
routes.Add("Category1Archive", new Route("{CategoryOne}/{Year}/{Month}", new CategoryAndPostHandler()));
routes.Add("Category2Archive", new Route("{CategoryOne}/{CategoryTwo}/{Year}/{Month}", new CategoryAndPostHandler()));
有無論如何知道{Year}和{Month}是否是數值。否則,此路由與其他路由衝突。