2

Closed

Make sure Attribute Routing and EnableCors play nicely together

description

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.
[RoutePrefix("api/profiles")]
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: http://aspnetwebstack.codeplex.com/discussions/438303
Closed Aug 18, 2013 at 6:17 PM by kichalla
Verified.

comments

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.