Last post Jul 18, 2017 06:50 AM by Edward Z
Jul 17, 2017 11:02 AM|Rainmater|LINK
in Web API 2 project I have an API like this.
public IHttpActionResult search(string q, [FromUri] pageParams p)
when is send the encoded value of below parameter it works.
but when send the encoded of below value I got Notfound error(404):
(why %20 does not work in routing?)
Jul 17, 2017 01:37 PM|JBetancourt|LINK
that was established in "url" definition on RFC 3986
supported characters are:
any other character including spaces have to be encoded with % symbol
Jul 18, 2017 05:14 AM|Rainmater|LINK
yes, but I'm sending the encoded version of above strings.
Jul 18, 2017 06:50 AM|Edward Z|LINK
For this issue, it is not related with Webapi nor url encoding, it is related with how Asp.Net handle some specific urls.
For your issue, you could add below configuration to web.config.
<httpRuntime targetFramework="4.6" relaxedUrlToFileSystemMapping="true"/>
And then the request will work by something like "http://localhost:9336/api/values/query-test%20/page" in Get Request.