HttpEncoder::HeaderNameValueEncode Method
Encodes a header name and value into a string that can be used as an HTTP header.
Assembly: System.Web (in System.Web.dll)
protected public: virtual void HeaderNameValueEncode( String^ headerName, String^ headerValue, [OutAttribute] String^% encodedHeaderName, [OutAttribute] String^% encodedHeaderValue )
Parameters
- headerName
- Type: System::String
The HTTP header name to encode.
- headerValue
- Type: System::String
The HTTP header value to encode.
- encodedHeaderName
- Type: System::String%
When this method returns, contains the encoded name to use for an HTTP header. This parameter is passed uninitialized.
- encodedHeaderValue
- Type: System::String%
When this method returns, contains the encoded value to use for an HTTP header. This parameter is passed uninitialized.
The HeaderNameValueEncode method takes input strings from the headerName and headerValue parameters and encodes them. The encoded values are returned as out parameters.
The HeaderNameValueEncode method uses the following logic to encode header names and values:
All characters whose Unicode value is less than ASCII character 32, except ASCII character 9, are URL-encoded into a format of %NN where the N characters represent hexadecimal values.
ASCII character 9 (the horizontal tab character) is not URL-encoded.
ASCII character 127 is encoded as %7F.
All other characters are not encoded.
NoteAlthough this method can be used for Unicode values, it is typically used for values in the ASCII range.
The default implementation of the HeaderNameValueEncode method returns the value of headerValue in encodedHeaderValue if headerValue is nullptr or is an empty string. Similarly, the default implementation returns the value of headerName in encodedHeaderName if headerName is nullptr or is an empty string.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.