-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Today we have UriBuilder accepting a string through UriBuilder().Query however as far as I know there are no tools in the framework to help you build such a string.
Now if you do this as a literal it's fairly easy to prove correct but when dynamically building it you have to be mindful that query string keys and values should be properly escaped.
Under the AspNetCore namespace there's QueryHelpers https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.webutilities.queryhelpers?view=aspnetcore-3.1
I would have expected something like this to be built in. It's after all an http-centric world we live in.
EDIT: Hmm apparently System.Web.HttpUtility is actually available on .net core (even though System.Web itself isn't) though it seems to have bugs and isn't really modern.
Related #31147 which was closed as a duplicate of #29736 though I see no mention of query string apis in the latter issue.
It seems to be time to create new modern http url manipulation apis.
To clarify, I wouldn't want to have to reference AspNetCore as a framework reference in libraries.