Latest web development tutorials

คุณสมบัติ ContentType ASP

อ้างอิงวัตถุการตอบสนอง อ้างอิงวัตถุตอบสนองสมบูรณ์

ContentType ตั้งค่าคุณสมบัติเป็นชนิดเนื้อหา HTTP สำหรับวัตถุการตอบสนอง

ไวยากรณ์

response.ContentType[=contenttype]

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

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

ตัวอย่าง

ถ้าเพจ ASP ไม่ได้ตั้งค่าคุณสมบัติ ContentType แล้วเริ่มต้นหัวชนิดเนื้อหาเช่นนี้

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>


อ้างอิงวัตถุการตอบสนอง อ้างอิงวัตถุตอบสนองสมบูรณ์