How can I shorten the query string?

492 Views Asked by At

I have an MVC Core application, and one of the forms on submit passes a too long query string:

HTTP Error 404.15 - Not Found The request filtering module is configured to deny a request where the query string is too long.

My action method looks like this:

public async Task<IActionResult> ExportAsync(int? itemId, SelectActiveOrInactive activeOrInactiveItems = SelectActiveOrInactive.Active)

Here is the form:

<form asp-controller="Allocation" asp-action="Index">

And here is the submit button:

<input type="submit" value="Export" asp-controller="Allocation" asp-action="ExportAsync" formmethod="get" class="btn btn-primary form-control mr-1" />

The query string really contains too much stuff, but I only need itemId and activeOrInactiveItems, as you can see. Is there a way to shorten the query string and strip out everything I don't need? I would prefer not to touch web.config.

0

There are 0 best solutions below