I have the following configured route:
routes.MapHttpRoute("oneKey",
"{controller}/{id}");
If I go to the endpoint /users/Maticicero
, the route will be correctly delegated to the GET
method in my UsersController
class.
However I am getting the id
parameter just as it was typed, like Maticicero
.
Since this is the primary key of my database, and the comparision is case sensitive, I need to normalize my ids to lowercase, that is:
id = id.ToLower()
I have to do this in every controller and in every method that takes the id
parameter.
Is there a way to tell my Web Api (or route handler) to automatically lower case these parameters (or the whole url)?