ContentType Property

HttpResponse.ContentType Property

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

[Visual Basic]
Public Property ContentType As String
public string ContentType {get; set;}
public: __property String* get_ContentType();
public: __property void set_ContentType(String*);
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 ".


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


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
if (Response.ContentType != "Text/HTML")


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

See Also

HttpResponse Class | HttpResponse Members | System.Web Namespace

© 2015 Microsoft