Latest web development tutorials

ASP ContentType property

Response Object Reference Complete Response Object Reference

ContentType property is set to HTTP content type for the response object.

grammar

response.ContentType[=contenttype]

参数 描述
contenttype 描述内容类型的字符串。

如需完整的内容类型列表,请参阅您的浏览器文档或 HTTP 规范。

Examples

If the ASP page is not set ContentType property, then the default content-type header like this:

content-type:text/html

Some other common ContentType values:

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

This regular meeting open an Excel spreadsheet (if you have installed Excel) in your browser:

<%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 Object Reference Complete Response Object Reference