The ASP ContentType Property is used to set the HTTP content type/subtype for the response header Object. The default value is text/HTML
Syntax:
response.ContentType[=contenttype]
Parameter Values: It Contains the string value i.e contentType Which represents the content type.
Example 1: This example illustrates the various type of content that asp pages have.
HTML
<%response.ContentType="text/HTML"%> <%response.ContentType="image/GIF"%> <%response.ContentType="image/JPEG"%> <%response.ContentType="text/plain"%> |
Example 2: This example code will produce a 2 X 4 Excel Spreadsheet in a browser if Excel is installed.
HTML
<%response.ContentType="application/vnd.ms-excel"%> < html >
< body >
< table >
< tr >
< td >Geeks</ td >
< td >for</ td >
< td >Geeks</ td >
< td >Sudo</ td >
</ tr >
< tr >
< td >C</ td >
< td >PHP</ td >
< td >Node</ td >
< td >CSS</ td >
</ tr >
</ table >
</ body >
</ html >
|
Output:
Article Tags :