ASP ContentType-attribut

response Object Reference Manual

ContentType-attributten sætter HTTP-indholdstypen for response-objektet.

Syntaks:

response.ContentType[=contenttype]
Parameter Beskrivelse
contenttype

Streng, der beskriver indholdstypen.

For en fuld liste over indholdstyper, se din browserdokumentation eller HTTP-standarden.

Eksempel

Hvis en ASP-side ikke har indstillet ContentType-attributten, sådan ser den standard content-type header ud:

content-type:text/html

Andre almindelige ContentType værdier:

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

Dette eksempel vil åbne en Excel elektronisk tabel i browseren (hvis brugeren allerede har installeret 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