This documentation is archived and is not being maintained.

HttpResponse.ContentEncoding Property

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

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

public Encoding ContentEncoding { get; set; }
/** @property */
public Encoding get_ContentEncoding ()

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

public function get ContentEncoding () : Encoding

public function set ContentEncoding (value : Encoding)

Property Value

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

Exception typeCondition

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 (ASP.NET Settings Schema) 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.

Response.Write (Response.ContentEncoding.EncodingName);
    

get_Response().Write(get_Response().get_ContentEncoding().
    get_EncodingName());

Response.Write(Response.ContentEncoding.EncodingName)
    

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, 1.1, 1.0
Show: