Wednesday, August 6, 2014

driving CORS through attributes?

http://msdn.microsoft.com/en-us/magazine/dn532203.aspx seems to show off an attribute-based approach to specifying CORS rules at an action at an ASP.NET MVC Web API controller like so:

[EnableCors("http://localhost:55912", "Accept, Origin, Content-Type", "POST",
      PreflightMaxAge=600)]
public HttpResponseMessage Post(Resource data)
{
   return Request.CreateResponse(HttpStatusCode.OK, data);
}

 
 

I haven't tried this stuff yet, but... I'm intrigued.

No comments:

Post a Comment