Are query string keys case sensitive?浏览器种输入url附带的参数是否区分大小写
Are query string keys case sensitive?
@gbjbaanb's answer is incorrect: The RFCs only specify the allowed character set for the query string. Like the path and fragment components of the URI, the query URI component only has meaning only to the authority providing the resource.
It is entirely up to that authority on whether this stuff is case-sensitive or not.
In the case of C# and IIS, the backing store for the parsed query string in the HttpRequest
object is a System.Collections.Specialized.NameValueCollection
which happens to be case-insensitive (by default).
Since that class offers other constructors allow different equality comparers to be provided, there is absolutely nothing to prevent an implementation from making it case-sensitive.
Further, since the page itself (and the client-side javascript) have access to the raw URI, they are free to do whatever they want with it.
If the query string is built as a result of an HTML form submission, the keys (names) come from the value of the form controls name
attribute, which the HTML specs say is case-sensitive. But as near as I know, nobody really does that.
So, at the end of the day, you have to know what the request handler is expecting in your query string. It might (or it might not) be case-sensitive.
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2018-10-16 NOT IN clause and NULL values
2017-10-16 GitBlit中出现 error: remote unpack failed: error Missing tree
2015-10-16 default parameter value for ‘color’ must be a compile-time constant