【发布时间】:2020-07-07 21:57:28
【问题描述】:
当我使用搜索参数搜索产品时,我想重定向 url /products/search/ 或 /products/id/search。
routes.MapRoute(
name: "products",
url: "products/{id}/{search}/{page}",
defaults: new { controller = "products", action = "Index", id = UrlParameter.Optional, page = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { action = "Index",id = UrlParameter.Optional }
);
当我在显示 /products?search=parametername 的搜索框 url 中搜索产品时。但是当点击显示 /products/search 的菜单项 url 时。
【问题讨论】:
标签: asp.net asp.net-mvc url-routing asp.net-mvc-routing