Note that there are some explanatory texts on larger screens.

plurals
  1. POThe "DELETE" type of Http request does not work in WebAPI?
    primarykey
    data
    text
    <p>I have GET, PUT, POST working in my WebAPI project. The last one of Http requests I am doing is DELeTE, BUT it does not work.</p> <p>I have read through many posts in here as well as other websites, none of them. e.g.</p> <p><a href="https://stackoverflow.com/questions/9692687/webapi-controller-is-not-being-reached-on-delete-command">WebAPI Controller is not being reached on DELETE command</a></p> <p><a href="https://stackoverflow.com/questions/15619075/webapi-delete-not-working-405-method-not-allowed">WebAPI Delete not working - 405 Method Not Allowed</a></p> <p><a href="https://stackoverflow.com/questions/13004052/asp-net-webapi-delete-verb-not-working">ASP.Net WebAPI Delete verb not working</a></p> <p><a href="https://stackoverflow.com/questions/10906411/asp-net-web-api-put-delete-verbs-not-allowed-iis-8">ASP.NET Web API - PUT &amp; DELETE Verbs Not Allowed - IIS 8</a></p> <p><a href="http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/8906fd7e-a60b-484e-be63-9574b9fca44a/" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/8906fd7e-a60b-484e-be63-9574b9fca44a/</a></p> <p>etc...</p> <p>Are there any workarounds?</p> <p>Please help, thanks.</p> <p>Update:</p> <p>My back-end code: </p> <pre><code> [HttpDelete] public HttpResponseMessage Delete(int divisionID) { if (divisionID != default(int)) { var found = dc.MedicareLocalAccounts.SingleOrDefault(m =&gt; m.DivisionID == divisionID); if (found == null) { return new HttpResponseMessage(HttpStatusCode.NotFound); } dc.MedicareLocalAccounts.Remove(found); dc.SaveChanges(); return new HttpResponseMessage(HttpStatusCode.OK); } return new HttpResponseMessage(HttpStatusCode.NotFound); } </code></pre> <p>Now, if I change the parameter type from int to any classes, let's say Division</p> <pre><code>Delete(Division d) { int divisionID = d.DivisionID; //....the rest is same } </code></pre> <p>In this way, it works.</p> <p>But I just do not want to input the entire object as a parameter to make the DELETE method work as it is not necessary.</p> <p>So do you have any other better solutions?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload