我正在使用.Net Core 2.1
我在控制器上没有任何ActionVerbs
时会碰到控制器的小形式。将method="delete"
添加到表单中并将[HttpDelete]
添加到控制器上后,我得到404。我在做什么错了?
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>