Skip to content
Related Articles

Related Articles

ASP ContentType Property
  • Last Updated : 31 Jul, 2020
GeeksforGeeks - Summer Carnival Banner

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:

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :