I am trying to convert my Web Api project to use attribute routing. One thing I am not understanding is the CreatedAtRoute method for a POST request. In my WebApiConfig.cs I used to have a
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/account/{accountId}/site/{siteId}/visitor/{visitorId}/session/{sessionId}/{controller}/{action}",
defaults: new { action = RouteParameter.Optional }
);
I commented this out thinking it was no longer needed, but CreatedAtRoute wants the name of the route and cant find it. So how is that handled with attribute routing?
See Question&Answers more detail:os