
ContentType | 363
HttpResponse
Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Parameter
Encoding
An Object variable of type Encoding. Its EncodingName property provides
the human-readable name of the encoding type.
Example
The example uses the properties of the Encoding class instance returned from the
ContentEncoding property to display the human-readable name and the regis-
tered (IANA) name of the current encoding:
Sub Page_Load( )
Message.Text = "Current encoding is " & _
Response.ContentEncoding.EncodingName & "<br/>"
Message.Text &= "Current encoding IANA name is " & _
Response.ContentEncoding.WebName & "<br/>"
End Sub
Notes
The ContentEncoding property is new in ASP.NET and provides a richer inter-
face for examining and modifying character set and code page information for the
current response. It also provides the only way to convert one character-encoded
string to another character encoding (i.e., Unicode to ANSI).
ContentType
String = Response.ContentType
Response.ContentType = String
Returns or sets a string containing the MIME type of the current response. This
allows you to retrieve or set the value of the HTTP Content-Type response
header.
Parameter
String
A string variable to receive or set the content type. The default is
"text/html".
Example
The following example displays the current MIME content type in the client
browser: ...