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
[C#]
public Encoding ContentEncoding {get; set;}
[C++]
public: __property Encoding* get_ContentEncoding();
public: __property void set_ContentEncoding(Encoding*);
[JScript]
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.

Exceptions

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

Remarks

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.

Example

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

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

[C#] 
Response.Write (Response.ContentEncoding.EncodingName);
    

[C++] 
Response->Write (Response->ContentEncoding->EncodingName);
    

[JScript] 
Response.Write(Response.ContentEncoding.EncodingName)
    

Requirements

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

See Also

HttpResponse Class | HttpResponse Members | System.Web Namespace

Show: