次の方法で共有


HttpResponse.ContentType プロパティ

出力ストリームの HTTP MIME タイプを取得または設定します。

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);

プロパティ値

出力ストリームの HTTP MIME タイプ。既定値は " text/html " です。

例外

例外の種類 条件
HttpException ContentType が null 参照 (Visual Basic の場合は Nothing) に設定されています。

解説

出力のコンテンツ タイプが "Text/HTML" ではない場合にアクションを実行する例を次に示します。

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

必要条件

プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ

参照

HttpResponse クラス | HttpResponse メンバ | System.Web 名前空間