Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HttpResponse.ContentType Property

Gets or sets the HTTP MIME type of the output stream.

[Visual Basic]
Public Property ContentType As String
[C#]
public string ContentType {get; set;}
[C++]
public: __property String* get_ContentType();
public: __property void set_ContentType(String*);
[JScript]
public function get ContentType() : String;
public function set ContentType(String);

Property Value

The HTTP MIME type of the output stream. The default value is " text/html ".

Exceptions

Exception Type Condition
HttpException ContentType is set to a null reference (in Visual Basic Nothing).

Remarks

The following example takes action if the content type of the output is not "Text/HTML".

[Visual Basic] 
If Response.ContentType <> "Text/HTML" Then
    ...
 End If
   
[C#] 
if (Response.ContentType != "Text/HTML")
 {
    ...
 }
   

Requirements

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

See Also

HttpResponse Class | HttpResponse Members | System.Web Namespace

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft