Delete Is Not Allowed By Access-control-allow-methods
I'm trying to send a cross-origin DELETE request from Chrome using jQuery. However, that fail with the following error message being logged in the developer console: XMLHttpReque
Solution 1:
The value of Access-Control-Allow-Methods
needs to be a comma separated list, not a space separated one.
From MDN:
Access-Control-Allow-Methods: <method>[, <method>]*
Solution 2:
In my case below configuration working. Hopefully this will help someone. Add this to your Web APIs "web.config" under the section <system.webServer>. I forgot where did I get this informaiton from.
<modules><removename="WebDAVModule" /></modules><httpProtocol><customHeaders><addname="X-Frame-Options"value="DENY" /><addname="Access-Control-Allow-Methods"value="*" /><addname="Access-Control-Allow-Headers"value="*" /></customHeaders></httpProtocol><handlers><removename="ExtensionlessUrlHandler-Integrated-4.0" /><removename="OPTIONSVerbHandler" /><removename="TRACEVerbHandler" /><removename="WebDAV" /><addname="ExtensionlessUrlHandler-Integrated-4.0"path="*."verb="*"type="System.Web.Handlers.TransferRequestHandler"preCondition="integratedMode,runtimeVersionv4.0" /></handlers>
Post a Comment for "Delete Is Not Allowed By Access-control-allow-methods"