2

I have an endpoint in my Web API 2 that gets a user by username. Unfortunately if the username has a period '.' in it I get an HTTP 404.0 error (the resource you are looking for is not found). However if I use the same test in Postman without the period character '.' it does actually route to the proper endpoint and tries to find the user passed. So, "joe.doe" gives me a 404 error but "joedoe" does not. I tried to Html encode it but it does not work either as the period character is not escaped even when I force it to be escaped to '%2e'. Strange as it may seem most other characters can be escaped, e.g. %20 - space, %60 - grave accent, etc. Is there a solution to this or do I just not let anyone create a username with a period character in it?

  • 1
    Possible duplicate of [Dot character '.' in MVC Web API 2 for request such as api/people/STAFF.45287](http://stackoverflow.com/questions/20998816/dot-character-in-mvc-web-api-2-for-request-such-as-api-people-staff-45287) – NightOwl888 Jul 14 '16 at 02:17
  • 2
    See also: [ApiController returns 404 when ID contains period](http://stackoverflow.com/questions/13298542/apicontroller-returns-404-when-id-contains-period), [MVC Web API: dot in URL parameter value](http://stackoverflow.com/q/33361785/181087), [Can periods be used in Asp.Net Web Api Routes?](http://stackoverflow.com/q/11494200/181087), [Web Api With Dot in the Route](http://www.seankenny.me/blog/2014/06/04/web-api-with-dot-in-the-route/). – NightOwl888 Jul 14 '16 at 02:27
  • Thanks for the redirects. The first one did the trick, i.e. 'Dot character...' – John Aschenbrenner Aug 11 '16 at 18:37

0 Answers0