I have a method in ExtJS
that sends to a C#
method. On the ExtJS
the user is using a button to delete a record. The C#
method than deletes the record in the database. When I use [HttpPost]
in front of the C#
method it works, when I changed to [HttpDelete]
I get a "NetworkError: 405 Method Not Allowed - http://localhost:5708/api/record" error.
Here is my C#
method
[HttpDelete]
[Route("api/record")]
public async Task<IHttpActionResult> Deleterecord(int recordInt)
{
}
Here is my ExtJS
listener
onClickDeleteButton: function () {
var viewRecord = this.getViewRecord();
var viewForm = this.getViewForm();
if (viewRecord && viewForm) {
viewForm.updateRecord();
viewForm.submit({
url: 'api/record',
method: "DELETE",
waitMsg: 'Deleting Record...',
scope: this,
});
}
},
Why is this not working when I use HTTPPost
but not HTTPDelete
?