1

I am using this Route filter

[Route("search/{*segments}")]

this takes all the segments I am providing which could be many.

Here is an example

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

Now I also need the query string with this route but I am unable to make it work.

http://localhost:50877/search/?query=HP%20DesignJet&items=HEW51645A|ELI75220

It gives me 403 error.

The Web server is configured to not list the contents of this directory

How can I make a route that can take wildcard and query string to handle the incoming request. I am bound to use search in Route.

Also I tried with this

http://localhost:50877/search/test?query=HP%20DesignJet&items=HEW51645A|ELI75220

It works but this effects the SEO.

1

1 Answer 1

1

Defining action and route this way:

[System.Web.Mvc.Route("search/{*segments}")]
public ActionResult Search(string segments, string query, string items)

allows to get wildcard (in segments variable) and also query string parameters (query and items)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.