Percent encoding of query string parameters
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
My service uses the following APIs to add URL query strings:
[QueryHelpers.AddQueryString](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.webutilities.queryhelpers.addquerystring?view=aspnetcore-8.0#microsoft-aspnetcore-webutilities-queryhelpers-addquerystring(system-string-system-string-system-string)) and [QueryBuilder.Add](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.extensions.querybuilder.add?view=aspnetcore-8.0#microsoft-aspnetcore-http-extensions-querybuilder-add(system-string-system-string))
According to [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986#section-2.2), I'm expecting all the reserved characters to be percent-encoded. But I notice that the following characters are not encoded:
`@!$()*,;`
In comparison, all reserved characters are being encoded by .NET Core [Uri.EscapeDataString](https://learn.microsoft.com/en-us/dotnet/api/system.uri.escapedatastring?view=net-8.0) API. Why is the behavior different in aspnetcore?
**QueryBuilder.Add**
**QueryHelpers.AddQueryString**
**Uri.EscapeDataString**
Contributor guide
Assessment
This issue has not been assessed yet.