I have the following routes set up in my webapi..
//Route for getting the api access token
config.Routes.MapHttpRoute(
name: "AccessTokenRoute",
routeTemplate: "api/access-token",
defaults: new { controller = "AccessToken" }
);
//Default route for the api
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
I have a controller called AccessTokenController. When a request comes in with the url /api/access-token, everything works fine. It hits the appropriate controller.
My problem is that if a request comes in at /api/AccessToken, it will also match the default route. I want to prevent the route from matching if they access it that way. Is there anything that exists in the routing system to do this?