0

I am using .Net Core 2.1

I have a smal form that hits the controller when I dont have any ActionVerbs on the controller. As soon as I add method="delete" to the form and [HttpDelete] on the controller I get 404. What am I doing wrong?

C#

[HttpDelete]
public ActionResult DeleteProduct(int? productID, int? subscriptionID)
{
}

HTML

<form method="delete" action="@Url.Action("DeleteProduct")">

<input name="productID" type="hidden" value="@product.ProductID" />
<input name="subscriptionID" type="hidden" value="@subscription.SubscriptionID" />

<button type="submit" class="btn btn-warning">
Tabort <i class="fa fa-trash trashIcon" aria-hidden="true"></i>
</button>

</form>
AllramEst
  • 1,319
  • 4
  • 23
  • 47

0 Answers0