In .NET Core Razor Pages, an anchor tag (<a>
) inside a <form>
can trigger OnPost
unexpectedly if it behaves like a submit button. To fix, ensure your <a>
is outside any <form>
tag or add type="button"
on buttons, or use href="#"
with onclick
for navigation to prevent form submission.