Being battling this issue for too long now it's time to ask for help. The delete route of my .net core mvc app is not being hit. All other routes (Get, Post) are hit just fine. The route config at startup looks like this:
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action}/{id?}");
});
The form submit looks something like this:
<a class="btn btn-primary" href="~/DisabledRegistrations/Delete/@(Model.Id)">Confirm</a>
The controller method looks like this:
[Authorize]
[HttpDelete]
public async Task<IActionResult> Delete(string id)
{
...
}
But hitting that with something like:
https://localhost:8307/DisabledRegistrations/Delete/f17dff6b3fcd43ba89eab4bbad5c992e
results in:
No webpage was found for the web address:
https://localhost:8307/DisabledRegistrations/Delete/f17dff6b3fcd43ba89eab4bbad5c992e
We run in Service Fabric and not sure if there's any particulars to that. Our web.config has this although not sure if it's relevant in that context:
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
Any hints for things to try are greatly appreciated.
UPDATE:
If I actually do submit a form as follows:
<form asp-controller="DisabledRegistrations" asp-action="Delete" method="delete" asp-route-id="@Model.Id">
<div class="text-right">
<button type="submit" class="btn btn-primary">Confirm</button>
<a class="btn btn-primary" href="~/DisabledRegistrations/Index">Cancel</a>
</div>
</form>
Then I still get:
No webpage was found for the web address:
https://localhost:8307/DisabledRegistrations/Delete/f17dff6b3fcd43ba89eab4bbad5c992e?__RequestVerificationToken=CfDJ8KwmDf2MXHlGrC8zIIntu4IV_83R9jSBwPqk3w8Ymq2VoBnQHN8lxEOHqMUfJwtxX-HLZwr6AWw8uKiVaSz7l-CZjPzZ_IxJhRh31MYiwbgsJzLcQMvrHWGd_sueZ8OLKbRAoYGeVHLfVfkjac-TCaLE9CoOYSCyhY4EDtrFhiLVY3_3h-bJTSLYTT2E7qXcvA