mardi 5 avril 2022

HTTP parameter pollution when checkbox is checked due to it sending duplicate parameter name

If an ASP.Net checkbox is checked, it will pass the same parameter twice. Once with the value false as a hidden field, and once with the value true.

This in turn causes our firewall to block the request due to HTTP Parameter Pollution.

How can I prevent the firewall from blocking the request due to HTTP parameter pollution?

The checkbox that is used to hide/display a table:

<div><input id="checkbox" asp-for="@Model.ShowTable" type="checkbox" /> Hide Table</div>

Hide/Show table:

$("#checkbox").click(function (e) {
    if ($('#checkbox').is(':checked')) {
        $("#table").prop('disabled', true);
        $("#table").hide();
    } else {
        $("#table").prop('disabled', false);
        $("#table").show();
    };
});



Aucun commentaire:

Enregistrer un commentaire