我的地址如下:
www.stack.com/Content/00000/solutions-about
如何在我的路线中指定何时上述网址
a) go to the Content controller
b) action of Get
c) five digits that follow will be put into a parameter called id?
如果“内容/”后面没有五个数字,我该如何进行其他操作,例如“错误”?
答案 0 :(得分:0)
你走了:
routes.MapRoute(
"Content",
"Content/{id}/{something}",
new { controller = "Content", action = "Get" },
new { id = @"^\d{5}$" }
);