If I create a form using form tag helper the submit button triggers the OnPost event
<form method="post" asp-page="login">
However if I use
<form method="post" action="/auth/login">
The OnPost event is not fired. And yes, asp-page="login" translates tp "/auth/login". Even if I use asp-page="login" and copy the url from the console inspector and paste onto my cshtml page, a blank page is returned.
Any thoughts?
CodePudding user response:
You can try to add @Html.AntiForgeryToken()
into the second form.When you use the second form,it will lose a hidden input which contains the antiforgery token.
<form method="post" action="/auth/login">
@Html.AntiForgeryToken()
<input type="submit" value="submit" />
</form>