HttpResponse.HeaderEncoding Property
Assembly: System.Web (in system.web.dll)
'Declaration Public Property HeaderEncoding As Encoding 'Usage Dim instance As HttpResponse Dim value As Encoding value = instance.HeaderEncoding instance.HeaderEncoding = value
/** @property */ public Encoding get_HeaderEncoding () /** @property */ public void set_HeaderEncoding (Encoding value)
public function get HeaderEncoding () : Encoding public function set HeaderEncoding (value : Encoding)
Not applicable.
Property Value
An Encoding containing information regarding the character set for the current header.| Exception type | Condition |
|---|---|
| The encoding value is a null reference (Nothing in Visual Basic). | |
| The encoding value is Unicode. - or - The headers have already been sent. |
The HeaderEncoding property gives you the ability to disable or change the Encoding object on a response header using either the ASCIIEncoding, UnicodeEncoding, UTF7Encoding, or UTF8Encoding object. The default encoding value is the T:System.Text.UTF8Encoding class.
Changing the type of the HeaderEncoding property potentially could invite certain malicious attacks or cause undesired data to be sent through the response header. Header injection attacks are avoided in part by leaving the HeaderEncoding property of a response to the default setting. An attack against a vulnerable application could echo back entrusted data as part of a response header. If the HeaderEncoding is disabled due to a requirement for continuation lines in a header or if any header is constructed based on the result of untrusted data, the header data should be validated prior to sending to the response stream.