This documentation is archived and is not being maintained.

HttpResponse.ContentEncoding Property

Gets or sets the HTTP character set of the output stream.

[Visual Basic]
Public Property ContentEncoding As Encoding
public Encoding ContentEncoding {get; set;}
public: __property Encoding* get_ContentEncoding();
public: __property void set_ContentEncoding(Encoding*);
public function get ContentEncoding() : Encoding;
public function set ContentEncoding(Encoding);

Property Value

A Encoding object containing information about the character set of the current response.


Exception Type Condition
ArgumentException Attempted to set ContentEncoding to a null reference (Nothing in Visual Basic).


Default ContentEncoding can be specified in an ASP.NET configuration file in the <globalization> Element section. If ContentEncoding is specified by the client, the default configuration settings are overridden.


The following example writes a human-readable description of the character set encoding to the output stream.

[Visual Basic] 
Response.Write (Response.ContentEncoding.EncodingName)

Response.Write (Response.ContentEncoding.EncodingName);

Response->Write (Response->ContentEncoding->EncodingName);



Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpResponse Class | HttpResponse Members | System.Web Namespace