ASP -ContentType- Eigenschaft
❮ Vollständige Antwortobjektreferenz
Die ContentType-Eigenschaft legt den HTTP-Inhaltstyp für das Antwortobjekt fest.
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. |
Beispiele
Wenn für eine ASP-Seite keine ContentType-Eigenschaft festgelegt ist, lautet der standardmäßige Content-Type-Header:
content-type:text/html
Einige andere allgemeine ContentType-Werte:
<%response.ContentType="text/HTML"%>
<%response.ContentType="image/GIF"%>
<%response.ContentType="image/JPEG"%>
<%response.ContentType="text/plain"%>
Dieses Beispiel öffnet eine Excel-Tabelle in einem Browser (wenn der Benutzer Excel installiert hat):
<%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>
❮ Vollständige Antwortobjektreferenz