Why is ASP.NET Core 5 replacing the URL query string with a random query string after the page prerender?

108 views Asked by At

I am creating an ASP.NET 5 Blazor Server application with MudBlazor.

I have a URL https://localhost:44324/OperationsAll?Proj_ID=23407&Tail_Nr=TG6R&Location=N. The query string is used to initialize the data on the OperationsAll page.

It works great in the prerender stage of the lifecyle, retrieving the query string and initializing the page with the correct data in the Oninitialized() method.

In the render stage of the lifecycle when Oninitialized() is run again, the query string has changed to 'https://localhost:44324/OperationsAll?id=1234ASSAf31', with the id always being something different. This, of course, then causes the page to not have the required data for the final render of the page.

An interesting bit of information is that the query string is not being replaced in the web browser address bar, that still remains as https://localhost:44324/OperationsAll?Proj_ID=23407&Tail_Nr=TG6R&Location=N. The query string is being replaced with the random ?id=ASDF!1234 within the HttpContext.

Why is the query string being replaced?

How do I keep the query string from changing during the page lifecycle?

0

There are 0 answers