Export (0) Print
Expand All

HttpResponse.Charset Property

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

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

public string Charset { get; set; }
/** @property */
public String get_Charset ()

/** @property */
public void set_Charset (String value)

public function get Charset () : String

public function set Charset (value : String)

Property Value

The HTTP character set of the output stream.

Exception typeCondition

HttpException

The Charset property was set after headers were sent.

The Charset property can be set to a null reference (Nothing in Visual Basic) to suppress the HTTP Content-Type header.

The following code example is an ASP.NET page that uses the StreamWriter class to write the values of three HttpResponse class properties to a text file: the StatusCode property, the StatusDescription property, and the Charset property. The code first creates a constant, named INFO_DIR, that contains the path and part of the file name for the text file. A counter is then created that is used to generate unique file names for each response. Next, the code references a StreamWriter object that will write the information about the request to the file.

The code then calls the WriteLine method to write the time the response was generated, and then writes the property values to the file. The code then closes the StreamWriter object.

// Set the Charset property to the
// Central European character set.        
Response.Charset = "iso-8859-2";

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

Community Additions

ADD
Show:
© 2014 Microsoft