X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

ASP ContentType Property


Response Object Reference Complete Response Object Reference

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

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.

Examples

If an ASP page has no ContentType property set, the default content-type header would be:

content-type:text/html

Some other common ContentType values:

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

This example will open an Excel spreadsheet in a 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 Complete Response Object Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook