ASP ContentTypeプロパティ
完全な Response オブジェクトリファレンス
ContentType プロパティは、response オブジェクトに HTTP コンテンツタイプを設定します。
構文
response.ContentType[=contenttype]
| パラメータ | 説明 |
|---|---|
| contenttype | コンテンツタイプを説明する文字列。 完全なコンテンツタイプのリストについては、ブラウザのドキュメントまたは HTTP 仕様を参照してください。 |
例
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"%>
<%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>
<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>
完全な Response オブジェクトリファレンス その他の拡張