title: How to send empty response when url is broken in web API?
body: <p>When I try to hit invalid endpoint which contains space. Example: </p>
  
  <blockquote>
    <p><a href="http://localhost/myapiproject/api/v1/property/1234/package" rel="nofollow noreferrer">http://localhost/myapiproject/api/v1/property/1234/package</a> /5678</p>
  </blockquote>
  
  <p>Server responds with complete stack trace. 
  Example: </p>
  
  <pre><code>Server Error in '/myapiproject' Application.
  
  The resource cannot be found. 
  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 
  
  Requested URL: http://localhost/myapiproject/api/v1/property/1234/package /5678
  Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1586.0 
  </code></pre>
  
  <p>I have tried Global Error handling methods to resolve the issue but no luck.
  I tried <a href="https://stackoverflow.com/questions/21901808/need-a-complete-sample-to-handle-unhandled-exceptions-using-exceptionhandler-i">Using ExceptionHandler</a></p>
  
  <p>I want to send empty response with 404 status code. How can I do that?</p>
  
  <p>I tried to capture exception in Application_Error method in Global.asax file. But this method is not being executed. I already have defined default controller which takes care of non existing urls with status code 404. It only fails when url contains space.</p>