ASP ContentType Attribute

response Object Reference Manual

The ContentType property sets the HTTP content type for the response object.

Syntax:

response.ContentType[=contenttype]
Parameter Description
contenttype

String describing the content type.

For a complete list of content types, please refer to your browser documentation or HTTP specifications.

Example

If the ContentType attribute is not set on the ASP page, the default content-type header is like this:

content-type:text/html

Other commonly used ContentType values:

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

This example will open an Excel spreadsheet in the browser (if the user has Excel installed):

<%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