Last post Jan 20, 2017 04:48 AM by priyalwalpita
Jan 20, 2017 01:09 AM|Gerome|LINK
I am working with a ASP.Net Web API 2 service and the firewall denies the DELETE method to go through (only POST and GET are allowed).
Is there a way that we can bypass this and invoke my DELETE method in the API?
Jan 20, 2017 04:48 AM|priyalwalpita|LINK
You can achieve what you are looking for using method overriding. All you need to do is , add following entry in the request header.
X-HTTP-Method-Override : DELETE
Then do a POST request to your resource.
In the WEB API server end, you need to handle this method overriding using DelegatingHandler. Then you need to analyse what is the value in X-HTTP-Method-Override attribute and perform your actual operation accordingly.