Dailycode.info

Short solution for short problems

API.NET: Web API How to handle space or %20 in URL route

Failed to load resource: the server responded with a status of 404 (Not Found)

accounts.bdo.be/:1 Failed to load ...Accounts/Lookup/A.D.V.%20/maxrows/10

This is what I got when trying to call a web API. The space, even encoded was giving trouble. When you have this problem, do not look to far, do not start rewriting the url. 

Just add this to your config file in the Web API:

<system.web>
    <compilation debug="true" targetFramework="4.6.1" />
    <httpRuntime targetFramework="4.5.2" relaxedUrlToFileSystemMapping="true" />
</system.web>

More info on this here:

https://stackoverflow.com/questions/13406265/webapi-route-404s-when-there-is-a-trailing-space-in-the-url




blog comments powered by Disqus