Is Request.Headers["Header-Name"]
in ASP.NET case-sensitive? And if it is, how should I get a certain header (e.g. "X-requested-with") if I don't know for sure what case the client will send it in?
officially, headers are case insensitive, however, it is common practice to capitalize the first letter of every word.
Yes the web. config file as well as Import directives and other portions of ASP.net are case sensitive. If you are using a case insensitive programming language some of this may change.
All HTTP header keys are converted to lowercase in both directions (since HTTP header keys are defined to be case-insensitive). You should use lowercase in all of your mapping and classification rules.
HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon ( : ), then by its value. Whitespace before the value is ignored.
no they are case-insensitive as per RFC2616
4.2 Message Headers
HTTP header fields, which include general-header (section 4.5),
request-header (section 5.3), response-header (section 6.2), and
entity-header (section 7.1) fields, follow the same generic format as that given in Section 3.1 of RFC 822 [9]. Each header field consists
of a name followed by a colon (":") and the field value. Field names
are case-insensitive. The field value MAY be preceded by any amount
of LWS, though a single SP is preferred. Header fields can be
extended over multiple lines by preceding each extra line with at
least one SP or HT. Applications ought to follow "common form", where one is known or indicated, when generating HTTP constructs, since
there might exist some implementations that fail to accept anything
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With