Unable to Call SQL Server Stored Procedure from ASP.NET Maker

I am using the following code in my Table to pass variables using the Custom view tag in my table field <a href ="executeReconCockpitUpdate?EntityID=@UrlEncode(CurrentPage.EntityID)&GLAccount=@UrlEncode(CurrentPage.GLAccount)&ReconYear=@UrlEncode(CurrentPage.ReconYear)&ReconMonth=@UrlEncode(CurrentPage.ReconMonth)">Execute Matching" </a>.

I have the following code in custom page executeReconCockpitUpdate

@using Microsoft.Extensions.Configuration

@inject IConfiguration Configuration



@{

    string connString = Configuration.GetSection("Databases")["DB:connectionstring"];

    string usrid = Configuration.GetSection("Databases")["DB:username"];

    string password = Configuration.GetSection("Databases")["DB:password"];



    connString = connString.Replace("{uid}", usrid).Replace("{pwd}", password);

    connString += "TrustServerCertificate=True;";



    string entityId = "";

    string glAccount = "";

    int reconYear = 0;

    int reconMonth = 0;

    string message = "";



    // ✅ Corrected method invocation

    if (IsPost())

    {

        entityId = Request.Form["EntityID"];

        glAccount = Request.Form["GLAccount"];

        int.TryParse(Request.Form["ReconYear"], out reconYear);

        int.TryParse(Request.Form["ReconMonth"], out reconMonth);



        if (!string.IsNullOrWhiteSpace(entityId) && !string.IsNullOrWhiteSpace(glAccount) &&

            reconYear > 0 && reconMonth > 0)

        {

            try

            {

                using (var con = new Microsoft.Data.SqlClient.SqlConnection(connString))

                {

                    con.Open();

                    using (var command = new Microsoft.Data.SqlClient.SqlCommand("SP_MLCockpitStaging", con))

                    {

                        command.CommandType = System.Data.CommandType.StoredProcedure;

                        command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@EntityID", entityId));

                        command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@GLAccount", glAccount));

                        command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@ReconYear", reconYear));

                        command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@ReconMonth", reconMonth));



                        command.ExecuteNonQuery();

                        message = "Reconciliation staging completed successfully.";

                    }

                    con.Close();

                }

            }

            catch (Exception ex)

            {

                message = "Error executing stored procedure: " + ex.Message;

            }

        }

        else

        {

            message = "Please fill in all fields correctly.";

        }

    }

}

The Stored Procedure does not execute when I select the Custom view tag in my table field

Open your project in Visual Studio 2022, add a break point in your codes and debug from there.