Export (0) Print
Expand All

HttpResponse.HeaderEncoding Property

Gets or sets an Encoding object representing the encoding for the current header output stream.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public Encoding HeaderEncoding { get; set; }
/** @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 typeCondition

ArgumentNullException

The encoding value is a null reference (Nothing in Visual Basic).

HttpException

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.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft