Razor Page does not calling OnPostAsync?
06:06 10 Dec 2025

I am creating an Razor Page that call two differents OnPostAsync which are OnPostAprovarAsync and OnPostReprovarAsync. To do this I have creating two differents forms on cshtml each one of with submit buttons but when I do the submit the form does not calling the their respective OnPostAsync. I tried to add a breakpoint and it does not trigger yet. How could I do this ?

[ValidateAntiForgeryToken]
public async Task OnPostAprovarAsync(string id)
{
    Console.Writeln("Into Aprovar OnPost");
    long _id = long.Parse(id);
    var solicitacao = await _context.SolicitacoesSaque
        .Include(s => s.Usuario)
        .FirstOrDefaultAsync(s => s.Id == _id);

    if (solicitacao == null || solicitacao.Status != StatusSaque.PENDENTE)
        return RedirectToPage();



[ValidateAntiForgeryToken]
public async Task OnPostReprovarAsync(string id, string motivo)
{
    Console.Writeln("Into Reprovar OnPost");
    long _id = long.Parse(id);
    var solicitacao = await _context.SolicitacoesSaque
        .Include(s => s.Usuario)
        .FirstOrDefaultAsync(s => s.Id == _id);

    if (solicitacao == null || solicitacao.Status != StatusSaque.PENDENTE)
        return RedirectToPage();

cshtml

 
 
@Html.AntiForgeryToken()
@Html.AntiForgeryToken()
asp.net-mvc asp.net-core