My server is returning a 404 error when a parameter has a space encoded as a +
instead of %20
. I don't understand why.
The route is of the form
[Route("/Search/PRM1/{prm1}/PRM2/{prm2}/PRM3/{prm3}")
My 1st question would be how to ask the server to understand this kind of URL?
https://example.com/Search/PRM1/prm1%20value/PRM2/prm2+value/PRM3/prm3%20value
My 2nd question would be how to automatically generate urls with +
instead of %20
, which are easier to read? Is there a difference regarding SEO?
URLs are generated on server side in cshtml:
<a href="/Search/PRM1/@prm1/PRM2/@prm2/PRM3/@prm3">link</a>
with prmX variables "clear" text (including spaces). The +
URL has been generated when using @System.Net.WebUtility.UrlEncode(prm2)
instead of @prm2
I have checked the link below, but the solution does not seem to work with ASP.Net Core: WebAPI route 404's when there is a trailing space in the URL