ASPContentTypeプロパティ_
❮完全な応答オブジェクトリファレンス
ContentTypeプロパティは、応答オブジェクトのHTTPコンテンツタイプを設定します。
構文
response.ContentType[=contenttype]
Parameter | Description |
---|---|
contenttype | A string describing the content type.
For a full list of content types, see your browser documentation or the HTTP specification. |
例
ASPページにContentTypeプロパティが設定されていない場合、デフォルトのcontent-typeヘッダーは次のようになります。
content-type:text/html
その他の一般的なContentType値:
<%response.ContentType="text/HTML"%>
<%response.ContentType="image/GIF"%>
<%response.ContentType="image/JPEG"%>
<%response.ContentType="text/plain"%>
この例では、ブラウザでExcelスプレッドシートを開きます(ユーザーがExcelをインストールしている場合)。
<%response.ContentType="application/vnd.ms-excel"%>
<html>
<body>
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
</tr>
</table>
</body>
</html>
❮完全な応答オブジェクトリファレンス