1
如何才能最好地表明L1Cat和L2Cat的值不能是整數值/不是由0-9數字組成,以防止頁面值被分配給它們網址請求。需要使用正則表達式來約束路由的幫助
routes.MapRoute(
"Store5", // Route name
"{RootPointer}/{L1Cat}/{L2Cat}/{page}", // URL with parameters
new
{
controller = "Store",
action = "Index",
RootPointer = UrlParameter.Optional,
page =1
},
new { controller = "Store", action = "Index", page = @"\d+" });
你能澄清你問什麼?那麼'L1Cat'和'L2Cat'只能包含非數字字符? – 2012-03-12 13:07:21
是的。或者更好的是可以包含數字,但不只是數字。只有與字母混合使用。 – LaserBeak 2012-03-12 13:09:15