Bad Request on Users Admin-Ui when using Razor Pages and .Net Framework

Hello guys,

This was a long one to debug, so bear with me…

We have two ServiceStack projects which were started back in 2021 using the Razor Pages template for .Net Framework and ServiceStack version 5.10.4. Both projects were in our development iterations until 2023 and got ServiceStack upgrades until version 6.4.0 and .Net Framework 4.7.2.

This month, I’ve had to add a new endpoint to both projects and decided to, while I’m got the repo checked out, to upgrade both to the latest and greatest ServiceStack version. Unfortunately there is no budget at this stage to change from .Net Framework to .Net 8 as they use libraries from legacy products which will remain in .Net Framework.

I’ve run into a ‘400 Bad Request’ issue in the Admin-Ui, specifically on the Users Admin page when the page loads and tries to do a Get request on the AdminQueryUsers endpoint.

Please refer to the screenshots below.

On ServiceStack versions 6.1.0 to 6.6.0, I have no problems on the Users page. From version 6.8.0 to the latest 8.2.2, I get a Bad Request. To my eyes, the only difference is in the orderBy parameter, which is missing an equal sign, i.e.:

Versions 6.1 to 6.6:

Versions 6.8 to 8.2.2:

Is this even the real issue? I don’t get this on .Net 6 or .Net 8 using the Blazor templates.

One more test…

When I execute the request from Firefox’s address bar, I get the following:

Query with orderBy=:

Query with orderBy:

Any advice / insights appreciated.

Thank you!

Looks like a .NET Framework issue that populates the NameValueCollection with null keys, should be resolved in the latest v8.2.3+ that’s now on Pre Release Packages.

1 Like

That’s awesome, thank you very much again @mythz !!

1 Like