Search code examples
asp.net-mvchttp-puthttp-delete

When should I use HttpDelete or HttpPut in an asp.net mvc application


I use always HttpGet or HttpPost even when my action is executing a delete method on the database.

For what should I use then HttpDelete/HttpPut ?


Solution

  • If you build an OData service.

    HTTP DELETE - Deletes the entity data that the specified resource represents. A payload is not present in the request or response messages.

    HTTP PUT - Replaces existing entity data at the requested resource with new data that is supplied in the payload of the request message. (msdn)

    There's a presentation with Scott Hanselman that might be interesting. (I haven't seen it yet.)

    There's also a couple of lectures on pluralsight on OData if you have a subscription there.