How to send PUT, DELETE HTTP request in HttpURLConnection?

To perform an HTTP PUT: URL url = new URL(“http://www.example.com/resource”); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setDoOutput(true); httpCon.setRequestMethod(“PUT”); OutputStreamWriter out = new OutputStreamWriter( httpCon.getOutputStream()); out.write(“Resource content”); out.close(); httpCon.getInputStream(); To perform an HTTP DELETE: URL url = new URL(“http://www.example.com/resource”); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setDoOutput(true); httpCon.setRequestProperty( “Content-Type”, “application/x-www-form-urlencoded” ); httpCon.setRequestMethod(“DELETE”); httpCon.connect();

How do I enable HTTP PUT and DELETE for ASP.NET MVC in IIS?

Go to Handler Mappings in your IIS Manager. Find ExtensionlessUrlHandler-Integrated-4.0, double click it. Click Request Restrictions… button and on Verbs tab, add both DELETE and PUT. EDIT: Possible WebDav Publisher issue You’ve mention on a deleted post you were running on a 2008 server right? Try removing webDav role, or disable it from your site … Read more