Export (0) Print
Expand All

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

Show:
© 2014 Microsoft