This project is read-only.


Make sure Attribute Routing and EnableCors play nicely together


I just received a report from a user where he only uses attribute routing and because of the HTTP method route constraint that we create from the attribute, no other HTTP methods can reach the Web API pipeline. That’s problematic for the preflight requests which sends an OPTIONS.
public class ProfilesController : ApiController
    [System.Web.Http.HttpGet("{personId}/app/{appId}", RouteName = "ProfileApiGetPersonApp")]
    public async Task<HttpResponseMessage> GetPersonApplicationProfile(Guid personId, Guid appId)
See the full context here:
Closed Aug 18, 2013 at 6:17 PM by kichalla


HongmeiG wrote Apr 1, 2013 at 11:41 PM

Good integration scenario between CORS and Attribute Routing!

We should add the OPTIONS to the routes added by attributed routing via the EnableCors gesture.