1

I'm attempting to send a DELETE request through csharp, ASP.NET and its returnin a (405) Error. Below is the code that I'm using:

request = System.Net.HttpWebRequest.Create(myTargetURL); request.Method = "DELETE"; response = (System.Net.HttpWebResponse)request.GetResponse();

Anybody can shed some light on this? is it something I'm not doing from a code point of view?

secretformula
  • 6,414
  • 3
  • 33
  • 56
William Calleja
  • 4,055
  • 11
  • 41
  • 51
  • Sounds like the web-server you are sending the request to is refusing to honor your request. This might be the case if the web-server has been configured to block DELETE requests. Have you checked this ? – Nikhil Nov 23 '10 at 09:38
  • Yep, sounds like the API does not allow DELETE. Check their documentation. – RPM1984 Nov 23 '10 at 09:39

1 Answers1

4

Looks like everything is working properly on your end and sounds like the server you are sending your DELETE method request to does not allow it.

10.4.6 405 Method Not Allowed

The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response MUST include an Allow header containing a list of valid methods for the requested resource.

Community
  • 1
  • 1
Erik Philips
  • 53,428
  • 11
  • 128
  • 150