Export (0) Print
Expand All

HttpResponse.HeaderEncoding Property

Note: This property is new in the .NET Framework version 2.0.

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:
property Encoding^ HeaderEncoding {
	Encoding^ get ();
	void set (Encoding^ value);
}
/** @property */
public Encoding get_HeaderEncoding ()

/** @property */
public void set_HeaderEncoding (Encoding value)

public function get HeaderEncoding () : Encoding

public function set HeaderEncoding (value : Encoding)

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).

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 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft