Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 1.1
.NET Framework
Reference
System.Web
HttpResponse Class
Properties
 ContentType Property

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2003/.NET Framework 1.1

Other versions are also available for the following:
.NET Framework Class Library
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

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker