ASP.Net MVC 5 路由通配符 + 查询字符串
ASP.Net MVC 5 Routing wildcard + querystring
我正在使用这个路由过滤器
[Route("search/{*segments}")]
这需要我提供的所有细分,可能有很多。
这是一个例子
http://localhost:50877/search/c_50_showcases%5E-displays/a_brand-name:33113319_balt:1623762%7Cmooreco:1672386/a_total-number-of-shelves:33111115429_5:3138:lt/so_ts
现在我还需要这个路由的查询字符串,但我无法让它工作。
http://localhost:50877/search/?query=HP%20DesignJet&items=HEW51645A|ELI75220
它给我 403
错误。
The Web server is configured to not list the contents of this directory
如何创建一个可以使用通配符和查询字符串来处理传入请求的路由。我必须在 Route
.
中使用 search
我也试过这个
http://localhost:50877/search/test?query=HP%20DesignJet&items=HEW51645A|ELI75220
有效,但这会影响 SEO。
以这种方式定义动作和路线:
[System.Web.Mvc.Route("search/{*segments}")]
public ActionResult Search(string segments, string query, string items)
允许获取通配符(在段变量中)以及查询字符串参数(查询和项)
我正在使用这个路由过滤器
[Route("search/{*segments}")]
这需要我提供的所有细分,可能有很多。
这是一个例子
http://localhost:50877/search/c_50_showcases%5E-displays/a_brand-name:33113319_balt:1623762%7Cmooreco:1672386/a_total-number-of-shelves:33111115429_5:3138:lt/so_ts
现在我还需要这个路由的查询字符串,但我无法让它工作。
http://localhost:50877/search/?query=HP%20DesignJet&items=HEW51645A|ELI75220
它给我 403
错误。
The Web server is configured to not list the contents of this directory
如何创建一个可以使用通配符和查询字符串来处理传入请求的路由。我必须在 Route
.
search
我也试过这个
http://localhost:50877/search/test?query=HP%20DesignJet&items=HEW51645A|ELI75220
有效,但这会影响 SEO。
以这种方式定义动作和路线:
[System.Web.Mvc.Route("search/{*segments}")]
public ActionResult Search(string segments, string query, string items)
允许获取通配符(在段变量中)以及查询字符串参数(查询和项)