I haven’t worked in ASP.NET MVC for a few years so I’m a little rusty. I can’t figure out what I’m missing so that my POST Action isn’t being hit when I submit my form. Here’s my view:
<form id="unsubscribe-form" method="post" action="Communication/Unsubscribe">
<div class="col-sm-12 col-md-9 mtl">
<button type="submit" id="btnSubmit" class="no-underline btn btn-orange btn-block">Yes, I'm Sure</button>
</div>
</form>
Here’s my action:
[Route("Communication/Unsubscribe")]
[AnyAccessType]
[HttpPost]
public ActionResult Unsubscribe(UnsubscribeViewModel model)
Is there something obvious I’m missing as to why this Action wouldn’t be hit?
2
Answers
Take a look at this question Here and this post Here
Should look something like this. If in doubt try hitting your controller with postman and see what happens. Hope this helps
fix your action route
and form