Response.ContentType

In the examples bellow, by using Include/virtual the asp file will send us a file originally writen in html format. The way this response page is displayed will depent on the ContentType we have defined. You may click in the file names to see them working.
 
 
 

ContentTypeexample1.asp
<!--#include virtual="/examples/ContentType.asp" --> The default option is used.
The content of the file will be "text/html"
ContentTypeexample2.asp
<% response.ContentType ="text/html" %> 
<!--#include virtual="/examples/ContentType.asp" -->
ContentType is defined as "text/html"
The result will be the same as above.
ContentTypeexample3.asp
<% response.ContentType ="text/plain" %> 
<!--#include virtual="/examples/ContentType.asp" -->
ContentType is defined as "text/plain"
The file will be displayed as text.
We will see the html source of the file. 

Similarly we may set up ContentType in order to fit the file type.

There are may different content types we may used, but we have include bellow only a few ones. If you want to find more types, just check in preferences from your browser for helper applications defined for different file types.
 
 

GIF images
<% response.ContentType ="image/gif" %> 
<!--#include virtual="/myimage.gif" -->
JPEG images
<% response.ContentType ="image/jpeg" %> 
<!--#include virtual="/myimage.jpeg" -->
TIFF images
<% response.ContentType ="image/tiff" %> 
<!--#include virtual="/myimage.tiff" -->
MICROSOFT WORD document
<% response.ContentType ="application/msword" %> 
<!--#include virtual="/myfile.doc" -->
RTF document
<% response.ContentType ="application/rtf" %> 
<!--#include virtual="/myfile.rtf" -->
MICROSOFT EXCEL document
<% response.ContentType ="application/x-excel" %> 
<!--#include virtual="/myfile.xls" -->
MICROSOFT POWERPOINT document
<% response.ContentType ="application/ms-powerpoint" %> 
<!--#include virtual="/myfile.pff" -->
PDF document
<% response.ContentType ="application/pdf" %> 
<!--#include virtual="/myfile.pdf" -->
ZIP document
<% response.ContentType ="application/zip" %> 
<!--#include virtual="/myfile.zip" -->









   



MSN Nick Name



More Resources...





Most Viewed Services:
  1. HTML Tutorial
  2. XHTML Tutorial
  3. CSS Tutorial
  4. Javascript Tutorial
  5. DHTML Tutorial
  6. VB Script
  7. TCP/IP Tutorial
  8. ADO Tutorial
  9. MYSQL Tutorial
  10. ASP Tutorial
  11. AJAX Tutorial
  12. CFML Tutorial
  13. PHP Tutorial
  14. WML Tutorial
  15. FLASH Tutorial
  16. XML Tutorial
  17. RSS Tutorial
  18. SQL Tutorial
  19. HTML Articles
  1. Javascript Articles
  2. PHP Articles
  3. SEO Articles
  4. Web Design Articles
  5. SEO Tips
  6. Web Design Tips
  7. Articles
  8. CSS
  9. CSS Tips
  10. HTML Tips
  11. JAVASCRIPT Tips
  12. MYSQL Tips
  13. PHP Tips
  14. Money
  15. Tutorials
  16. Web Hosting



  • Home
  • Web Directory
  • Top Directoriers
  • Webmaster Directories
  • Contact
  • © Copyright 2006-2010 All Rights Reserved By CodeDcode.Com : HTML : RSS : TEXT : XML