I think this is the second time I’ve struggled with this. When you have a GET parameter in ASP.Net Web API (or even in MVC) that has a period in it, it does not work with the new project web.config. Examples of this would be an email address (api/user/foo@test.com), a price (api/prices/0.00), or a custom ID (api/widget/QWERTY.67890). All of these will return a very unhelpful 404 error about the resource not being found. This is because IIS is trying to map everything after the period as an extension, and not finding it. The easy fix is to add the following to the web.config in system.webServer.

<modules runAllManagedModulesForAllRequests=“true” />

Solution found here:
WebAPI 2 Route Attribute with string parameter containing a period doesn’t bind

Comments


Comments are closed