ASP ContentTypeProperty


Response 对象参考手册Complete Response Object Reference Manual

The ContentType property sets the HTTP content type for the response object.

Syntax

response.ContentType[=contenttype]

Parameter Description
contenttype A string that describes the content type.

For a complete list of content types, please refer to your browser documentation or the HTTP specification.

Example

If an ASP page does not set the ContentType property, the default content-type header is:

content-type:text/html

Some other commonly used ContentType values:

<%response.ContentType="text/HTML"%>
<%response.ContentType="image/GIF"%>
<%response.ContentType="image/JPEG"%>
<%response.ContentType="text/plain"%>

This example opens an Excel spreadsheet in the browser (if the user has Excel installed):

<%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>


Response 对象参考手册Complete Response Object Reference Manual Other Extensions