首页 新闻 会员 周边

mvc路由问题

0
悬赏园豆:30 [待解决问题]
怎么设置路由表让 
list/c-1 怎么匹配到 home/ProductList?twoCategoryID=1
list/b-1 怎么匹配到 home/ProductList?brandID=1
梦亦晓的主页 梦亦晓 | 初学一级 | 园豆:112
提问于:2016-04-05 17:01
< >
分享
所有回答(1)
0

Route("list/c-{twoCategoryID}")

Route("list/b-{brandID}")

吴瑞祥 | 园豆:29449 (高人七级) | 2016-04-05 22:40

路由这样设置

routes.MapRoute(
"list1",
"list/c-{twoCategoryID}",
new { controller = "home", action = "ProductList", twoCategoryID = UrlParameter.Optional },
new { twoCategoryID = @"[\d]{0,11}" }
);
routes.MapRoute(
"list2",
"list/b-{brandID}",
new { controller = "home", action = "ProductList", id = UrlParameter.Optional },
new { brandID = @"[\d]{0,11}" }
);

 

只有list/c-1有效,list/b-1无效

支持(0) 反对(0) 梦亦晓 | 园豆:112 (初学一级) | 2016-04-06 09:05
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册