I have an ASP.NET Web API application and I have an action that takes one string parameter, such as:
[HttpGet]
public HttpResponseMessage GetById(string id)
{
// ...
}
It is registered accordingly:
config.Routes.MapHttpRoute("Resources", "api/resources/{id}", new
{
controller = "Resources",
action = "GetById"
});
Now, when someone calls api/resources/con, IIS gives 404. Almost any other value is OK, like api/resources/something or api/resources/nothing.
We have looked over and found that none of the reserved MS-DOS Device Driver Names can be used as a parameter value.
This appears to be a global issue, since MSDN has it too:
Is there any way to allow these names to be used as route parameters values?
Add this in Web.config, under system.web.
<httpRuntime relaxedUrlToFileSystemMapping="true" />