I have an asp.net core 2.2 mvc action method and GET
it from the client JavaScript code :
[Route("/search/{searchterm}")]
public IActionResult Search(string searchterm)
{
// code
}
Now, when I navigate to search with the searchstring abc/def
the uri in the browser is /search/abc%2Fdef
because the / gets encoded
I get a 404
though, because the routing attribute decoded the slash and the says /search/abc/def
does not match my route.
What I want is to treat the %2F
as a normal piece of content so the searchstring is abc/def
inside of my action method.
Funny(?) thing is, this does not happen on my local machine where I run from VS2017 (which runs Kestrel I guess) but only on the test server where it runs on IIS.
Is this an IIS thing? or maybe the loadbalancer is doing something?