title: Getting Method Not Allowed when using AngularJS Delete
body: <p>I'll be glad to get your help. I'm using AngularJS version 1.6.5 and trying to use http delete method. On server side i'm using asp.net MVC5 Web API.
  When i'm trying to delete a record i'm getting error 405 (Method Not Allowed).</p>
  
  <p>This is my AngularJS code:</p>
  
  <pre><code>$scope.Delete = function (CustomerNumber) {
      $http.defaults.headers["delete"] = {
          'Content-Type': 'application/json,charset=utf-8'
      };
      $http({
          method: "DELETE",
          url: "/Api/Customer/" + CustomerNumber
      }).then(function successCallback(response) {
          $scope.Customers = response.data;
          $scope.addCustomer.$setPristine();
          $scope.addCustomer.$setUntouched();
          $scope.Customer = {};
          $scope.error = "";
      }, function errorCallback(response) {
          $scope.error = "Error on delete customer (" + response.status + ") - " + response.statusText;
      });
  };
  </code></pre>
  
  <p>and this is my asp.net code:</p>
  
  <pre><code>public List&lt;Customer&gt; Delete(string CustomerNumber)
      {
          DataLayer dal = new DataLayer();
          CustomerViewModel cvm = new CustomerViewModel();
  
          Customer cust = (from x in dal.Customers where x.CustomerNumber == CustomerNumber select x).ToList&lt;Customer&gt;()[1];
          dal.Customers.Remove(cust);
          dal.SaveChanges();
  
          cvm.customers = dal.Customers.ToList&lt;Customer&gt;();
  
          return cvm.customers;
      }
  </code></pre>
  
  <p>I tried many ways and none of them worked. I would like to get your help.
  Thank you.</p>