ASP » Response » ContentType

The ContentType property specifies the HTTP content type/subtype for the response header.

The ContentType property specifies the HTTP content type, which includes a type/subtype, for the response header. The type is the general content, and the subtype is the specific content. The default is text/HTML.

This example code will produce a 2 X 2 Excel Spreadsheet in a browser, if Excel is installed on the client machine.

Examples

Code:
<% Response.ContentType = "application/vnd.ms-excel" %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>2</TD><!--- Cell : A1 --->
<TD>4</TD><!--- Cell : B1 --->
</TR>
<TR>
<TD>5</TD><!--- Cell : A2 --->
<TD>6</TD><!--- Cell : B2 --->
</TR>
</TABLE>
</BODY>
</HTML>