不同的ContentType 会影响客户端所看到的效果.默认的ContentType为 text/html 也就是网页格式.
代码如:
<% response.ContentType ="text/html" %>
<!--#i nclude virtual="/ContentType.html" -->
显示的为网页,而
<% response.ContentType ="text/plain" %>
<!--#i nclude virtual="/sscript/ContentType.html" -->
则会显示html原代码.
以下为一些常用的 ContentType
GIF images
<% response.ContentType ="image/gif" %>
<!--#i nclude virtual="/myimage.gif" -->
JPEG images
<% response.ContentType ="image/jpeg" %>
<!--#i nclude virtual="/myimage.jpeg" -->
TIFF images
<% response.ContentType ="image/tiff" %>
<!--#i nclude virtual="/myimage.tiff" -->
MICROSOFT WORD document
<% response.ContentType ="application/msword" %>
<!--#i nclude virtual="/myfile.doc" -->
RTF document
<% response.ContentType ="application/rtf" %>
<!--#i nclude virtual="/myfile.rtf" -->
MICROSOFT EXCEL document
<% response.ContentType ="application/x-excel" %>
<!--#i nclude virtual="/myfile.xls" -->
MICROSOFT POWERPOINT document
<% response.ContentType ="application/ms-powerpoint" %>
<!--#i nclude virtual="/myfile.pff" -->
PDF document
<% response.ContentType ="application/pdf" %>
<!--#i nclude virtual="/myfile.pdf" -->
ZIP document
<% response.ContentType ="application/zip" %>
<!--#i nclude virtual="/myfile.zip" -->
下面是更详细的ContentType
'ez' => 'application/andrew-inset',
'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
'doc' => 'application/msword',
'bin' => 'application/octet-stream',
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => 'application/octet-stream',
'class' => 'application/octet-stream',
'so' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => 'application/pdf',
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => 'application/vnd.ms-excel',
'ppt' => 'application/vnd.ms-powerpoint',
'wbxml' => 'application/vnd.wap.wbxml',
'wmlc' => 'application/vnd.wap.wmlc',
'wmlsc' => 'application/vnd.wap.wmlscriptc',
'bcpio' => 'application/x-bcpio',
'vcd' => 'application/x-cdlink',
'pgn' => 'application/x-chess-pgn',
'cpio' => 'application/x-cpio',
'csh' => 'application/x-csh',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'spl' => 'application/x-futuresplash',
'gtar' => 'application/x-gtar',
'hdf' => 'application/x-hdf',
'js' => 'application/x-javascript',
'skp' => 'application/x-koan',
'skd' => 'application/x-koan',
'skt' => 'application/x-koan',
'skm' => 'application/x-koan',
'latex' => 'application/x-latex',
'nc' => 'application/x-netcdf',
'cdf' => 'application/x-netcdf',
'sh' => 'application/x-sh',
'shar' => 'application/x-shar',
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'sv4cpio' => 'application/x-sv4cpio',
'sv4crc' => 'application/x-sv4crc',
'tar' => 'application/x-tar',
'tcl' => 'application/x-tcl',
'tex' => 'application/x-tex',
'texinfo' => 'application/x-texinfo',
'texi' => 'application/x-texinfo',
't' => 'application/x-troff',
'tr' => 'application/x-troff',
'roff' => 'application/x-troff',
'man' => 'application/x-troff-man',
'me' => 'application/x-troff-me',
'ms' => 'application/x-troff-ms',
'ustar' => 'application/x-ustar',
'src' => 'application/x-wais-source',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => 'application/zip',
'au' => 'audio/basic',
'snd' => 'audio/basic',
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'kar' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => 'audio/mpeg',
'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
'm3u' => 'audio/x-mpegurl',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'wav' => 'audio/x-wav',
'pdb' => 'chemical/x-pdb',
'xyz' => 'chemical/x-xyz',
'bmp' => 'image/bmp',
'gif' => 'image/gif',
'ief' => 'image/ief',
'jpeg' => 'image/jpeg',
'jpg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'png' => 'image/png',
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'djvu' => 'image/vnd.djvu',
'djv' => 'image/vnd.djvu',
'wbmp' => 'image/vnd.wap.wbmp',
'ras' => 'image/x-cmu-raster',
'pnm' => 'image/x-portable-anymap',
'pbm' => 'image/x-portable-bitmap',
'pgm' => 'image/x-portable-graymap',
'ppm' => 'image/x-portable-pixmap',
'rgb' => 'image/x-rgb',
'xbm' => 'image/x-xbitmap',
'xpm' => 'image/x-xpixmap',
'xwd' => 'image/x-xwindowdump',
'igs' => 'model/iges',
'iges' => 'model/iges',
'msh' => 'model/mesh',
'mesh' => 'model/mesh',
'silo' => 'model/mesh',
'wrl' => 'model/vrml',
'vrml' => 'model/vrml',
'css' => 'text/css',
'html' => 'text/html',
'htm' => 'text/html',
'asc' => 'text/plain',
'txt' => 'text/plain',
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'sgml' => 'text/sgml',
'sgm' => 'text/sgml',
'tsv' => 'text/tab-separated-values',
'wml' => 'text/vnd.wap.wml',
'wmls' => 'text/vnd.wap.wmlscript',
'etx' => 'text/x-setext',
'xsl' => 'text/xml',
'xml' => 'text/xml',
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'mxu' => 'video/vnd.mpegurl',
'avi' => 'video/x-msvideo',
'movie' => 'video/x-sgi-movie',
'ice' => 'x-conference/x-cooltalk'
分享到:
相关推荐
ASP.NET 中 Response.ContentType 类型汇总 ASP.NET 中的 Response.ContentType 属性用于确定输出的文件类型,告诉浏览器如何处理服务器返回的数据。不同的文件类型对应不同的 ContentType,今天我们来总结 ASP...
【ASP基础与Response对象】 ASP(Active Server Pages)是微软推出的一种服务器端脚本环境,用于创建动态交互式网页。它允许开发者使用多种脚本语言(如VBScript或JScript)来编写网页代码,实现服务器端的数据处理...
下面我们将详细探讨如何在ASP中实现这个功能。 首先,我们需要一个数据库,比如SQL Server或MySQL,其中包含一个用于存储二进制数据的字段。在ASP中,我们通常会使用ADO (ActiveX Data Objects) 来连接和操作数据库...
本文将详细介绍`Response`对象的集合、属性和方法,帮助你更好地理解和利用这一工具。 **集合** 1. **Cookies**: `Response.Cookies`集合允许开发者创建、读取或修改HTTP Cookie。Cookie是服务器发送到用户浏览器...
#### 五、更详细的ContentType列表 除了上述提到的常用ContentType外,还有一些其他的类型,例如: - **ez (application/andrew-inset)** - **hqx (application/mac-binhex40)** - **cpt (application/mac-...
Response.ContentType = "application/x-shockwave-flash"; break; case "xls": Response.ContentType = "application/vnd.ms-excel"; break; case "gif": Response.ContentType = "image/gif"; break; ...
(2)详细日志能力,便于你查看问题所在; (3)设置邮件发送的优先级; (4)支持多种格式的邮件发送,比如说以HTML或者TXT的方式发送邮件。这是个免费的组件。 (5)密件发送/(CC)抄送/紧急信件发送...
这篇文档主要是对ASP入门的一些基础知识进行了整理,主要关注Request和Response两个核心对象的应用。 首先,我们来看Request对象。Request对象在网页设计中用于获取客户端向服务器发送的信息。以下是一些关键点: ...
Response.ContentType = “Application/msword”; string s=Server.MapPath(“C#语言参考.doc”); Response.WriteFile(“C#语言参考.doc”); Response.Write(s); Response.Flush(); Response.Close(); 第...
《金鹰asp超速入门视频教程-044.Response属性.rar》是一份专门针对ASP初学者的教程资源,旨在帮助用户快速理解并掌握ASP(Active Server Pages)编程中的Response对象及其属性。ASP是一种广泛应用于网站开发的服务器...
在Asp.net编程中,了解`Response.Charset`与`Response.ContentEncoding`的区别至关重要,因为它们直接影响着网页内容的编码和解码过程,从而影响到客户端的正确显示。以下是对这两个属性的详细解释: 1. **Response...
Response.ContentType = "application/x-zip-compressed"; Response.AddHeader("Content-Disposition", "attachment;filename=z.zip"); string filename = Server.MapPath("DownLoad/aaa.zip"); Response....
本文将详细介绍如何确保通过`Response.Redirect`方法传递的汉字能够被正确接收。 #### 一、问题分析 当使用`Response.Redirect`方法传递包含汉字的参数时,最常见的问题是接收端获取到的参数变为乱码。这主要是...
同时,使用 Response.ContentType 属性指定文件的类型,然后使用 Response.WriteFile 方法将文件发送到客户端。 2. 文件下载的实现 文件下载的实现需要使用 TRY-CATCH 语句来捕捉可能出现的异常。例如,在下载文件...
Response.ContentType = "Application/msword"; string s = Server.MapPath("C#语言参考.doc"); Response.WriteFile("C#语言参考.doc"); Response.Write(s); Response.Flush(); Response.Close(); ``` - ...
在处理不同类型的文件或数据时,正确设置 `Response.ContentType` 是确保内容能够被客户端正确识别和处理的关键步骤。开发人员需要根据实际发送的数据类型来调整这个属性,以确保最佳的用户体验。
在ASP(Active Server Pages)开发中,经常遇到的一个问题是中文字符在`Response.Write`或JavaScript中显示为乱码。这通常涉及到字符编码设置的问题。在本文中,我们将深入探讨这个问题并提供解决方案。 首先,我们...