Response.ContentType
ContentType属性为响应指定了HTTP内容类型。如果没有指定ContentType,默认是text/HTML。
句法
Response.ContentType [=ContentType]
参数
- ContentType
- 一个字符串,描述了内容类型。该字符串通常格式化为“类型/子类型”,其中,类型是通用内容类别,子类型是特定的内容类型。欲得被支持的内容类型的完整列表,请参阅你的Web浏览器文档,或者 MIME Media Types的当前文档。
适用于
示例代码
下面的示例把内容类型设置为通道定义格式(CDF)。
<% Response.ContentType = "application/x-cdf" %>
下面的示例把ContentType属性设置为其它常见值。
<% Response.ContentType = "text/HTML" %> <% Response.ContentType = "image/GIF" %> <% Response.ContentType = "image/JPEG" %> <% Response.ContentType = "text/plain" %> <% Response.ContentType = "image/JPEG" %>
必备条件
Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.
Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.
Product: IIS