HttpDelete无法正常工作,但是当我使用HttpPost时它会

时间:2016-01-08 00:55:32

标签: c# http extjs

我在ExtJS中有一个发送到C#方法的方法。在ExtJS上,用户使用按钮删除记录。 C#方法比删除数据库中的记录。当我在[HttpPost]方法前面使用C#时,当我更改为[HttpDelete]时,我收到“NetworkError:405 Method Not Allowed - http://localhost:5708/api/record”错误。

这是我的C#方法

    [HttpDelete]
    [Route("api/record")]

    public async Task<IHttpActionResult> Deleterecord(int recordInt)
    {

    }

这是我的ExtJS听众

  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,
      });
    }
  },

为什么当我使用HTTPPost而不是HTTPDelete时,这不起作用?

0 个答案:

没有答案
相关问题