像这样的网址:
/query/test/p1s1c1
行动是:
public ActionResult Test(int price = 1, int size = 1, int category = 1)
{
ViewBag.param = "price:" + price + "size:" + size + "category" + category;
return View();
}
我的路线映射是:
routes.MapRoute(
"Query", // Route name
"Query/test/p{price}s{size}c{category}",
new { controller = "Query", action = "Test", price = UrlParameter.Optional, size = UrlParameter.Optional, category = UrlParameter.Optional },
new { price = @"\d+", size = @"\d*" , category = @"\d*" } // Parameter defaults
);
但它不起作用,谁能帮助我?