ASP ContentType Attribute

response Object Reference Manual

Ang ContentType attribute ay nagtatakda ng HTTP content type para sa response object.

Grammar:

response.ContentType[=contenttype]
Parametro Naglalarawan
contenttype

Ang string na naglalarawan ng uri ng nilalaman.

Para sa kumpletong listahan ng mga content type, mangyaring basahin ang dokumento ng iyong browser o ang HTTP na pamantayan.

Halimbawa

Kung walang itinakda ang ContentType property ng ASP na pahina, ang kasalukuyang content-type header ay gayon:

content-type:text/html

Ilang karaniwang.ContentType na pinagmumulan:

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

Ang halimbawa na ito ay magbukas ng isang Excel na elektronikong talahanayan sa browser (kung may i-install na ang user ang 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 Object Reference Manual