加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

ContentType 属性为 response 对象设置 HTTP 内容类型

发布时间:2023-10-09 15:03:46 所属栏目:Asp教程 来源:
导读:ContentType 属性为 response 对象设置 HTTP 内容类型。

语法

response.ContentType[=contenttype]

参数 描述

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

如需完整的内容类型列表,请参阅您的浏览器文
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>
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章