目录搜索
文字
分享

ASP ContentType 属性




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

语法

1

<div> response.ContentType[=contenttype] </div>


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

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

实例

如果 ASP 页面没有设置 ContentType 属性,那么默认的 content-type 头部是这样的:

1

<div> content-type:text/html </div>

其他一些常用的 ContentType 值:

1

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

此例会在浏览器中打开一个 Excel 电子表格(如果用户已经安装了 Excel ):

1

<div> <%response.ContentType="application/vnd.ms-excel"%><br> <html><br> <body><br> <table><br> <tr><br> <td>1</td><br> <td>2</td><br> <td>3</td><br> <td>4</td><br> </tr><br> <tr><br> <td>5</td><br> <td>6</td><br> <td>7</td><br> <td>8</td><br> </tr><br> </table><br> </body><br> </html> </div>


上一篇:ASP Charset 属性下一篇:ASP Expires 属性