自强学堂
自强学堂:学习、分享、让你更强!
ASP 实例HTMLCSSJAVASCRIPTJQUERYSQLPHPBOOTSTRAPANGULARXML
 

ASP ContentType 属性

Response 对象参考手册 完整的 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"%>

此例会在浏览器中打开一个 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>


Response 对象参考手册 完整的 Response 对象参考手册