Vlastnost ContentType ASP


❮ Dokončete referenci objektu odezvy

Vlastnost ContentType nastavuje typ obsahu HTTP pro objekt odpovědi.


Syntax

response.ContentType[=contenttype]

Parameter Description
contenttype A string describing the content type.

For a full list of content types, see your browser documentation or the HTTP specification.


Příklady

Pokud stránka ASP nemá nastavenou vlastnost ContentType, výchozí záhlaví typu obsahu by bylo:

content-type:text/html

Některé další běžné hodnoty ContentType:

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

Tento příklad otevře excelovou tabulku v prohlížeči (pokud má uživatel nainstalovaný 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>

❮ Dokončete referenci objektu odezvy