title: Error 404 when calling POST method in asp.net mvc Core 2.1
body: <p>I'm working on my first MVC Core 2.1 app and encountered problem (i guess with the routing). When calling a POST method shown below:</p>
  
  <pre><code>    [HttpPost]
      public RedirectToActionResult Remove(int id)
      {
          Product p = _repository.Products.Where(x =&gt; x.Id == id).FirstOrDefault();
          _repository.Products.Remove(p);
          _repository.SaveChanges();
          return RedirectToAction("Index");
      }
  </code></pre>
  
  <p>i get the error 404 page not found. Below  tag located in a partial view which sends the request:</p>
  
  <pre><code>&lt;a method="POST" asp-controller="Product" asp-action="Remove" asp-route-id="@Model.Id" class="btn btn-danger"&gt;Delete&lt;/a&gt;
  </code></pre>
  
  <p>it generates "<a href="https://localhost:44398/Product/Remove/3" rel="nofollow noreferrer">https://localhost:44398/Product/Remove/3</a>" (on product with id 3) which seems to be matching </p>
  
  <p>I'm using default routing</p>
  
  <pre><code>app.UseMvc(routes =&gt;
          {
              routes.MapRoute(
                  name: "default",
                  template: "{controller=Home}/{action=Index}/{id?}");
          });
  </code></pre>
  
  <p>also, if i change this same method from POST to get (getting rid of the database code) i'm able to access it</p>
  
  <pre><code>    [HttpGet]
      public RedirectToActionResult Remove(int id)
      {
  
          return RedirectToAction("Index");
      }
  </code></pre>
  
  <p>I bet I've made some stupid mistake, but I'm stuck with it and can't find the answer. Any help will be appreciated!</p>