The requested resource does not support http method ‘OPTIONS’

This error is closely related CORS.  You are probably getting this error with HTTP 405 errors, maybe using a Chrome or Firefox browser.  You may be doing an ajax POST.

If you are using ASP.NET WebAPI 2, you can enable CORS.

This article is for ASP.NET WebApi.  Many online solutions states that you need to add customHeaders.

<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, HEAD" />
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />

Now, if you use attribute routing in your project, you should create a method like the following:

public HttpResponseMessage Options()
var resp = new HttpResponseMessage(HttpStatusCode.OK);
return resp;

Note: make sure “<remove name=”OPTIONSVerbHandler” />” is in your web.config.  Disable WebDAV if you have it.

Special thanks to this article that finally solves it for me.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s