`
cwd306972384
  • 浏览: 34827 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

response

    博客分类:
  • java
 
阅读更多

Response.ContentType 详细列表

不同的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" -->

RAR document

Response.ContentType = "application/x-msdownload ; Charset=utf-8";   
Response.AddHeader("Content-Disposition", "attachment; filename=...");

 

下面是更详细的ContentType

前边为Type 后边为相应类型,只需要TYPE就可以.


application/andrew-inset ez  
application/mac-binhex40 hqx  
application/mac-compactpro cpt  
application/mathml+xml mathml  
application/msword doc  
application/octet-stream bin dms lha lzh exe class so dll  
application/oda oda  
application/ogg ogg  
application/pdf pdf  
application/postscript ai eps ps  
application/rdf+xml rdf  
application/smil smi smil  
application/srgs gram  
application/srgs+xml grxml  
application/vnd.mif mif  
application/vnd.mozilla.xul+xml xul  
application/vnd.ms-excel xls  
application/vnd.ms-powerpoint ppt  
application/vnd.wap.wbxml wbxml  
application/vnd.wap.wmlc .wmlc wmlc  
application/vnd.wap.wmlscriptc .wmlsc wmlsc  
application/voicexml+xml vxml  
application/x-bcpio bcpio  
application/x-cdlink vcd  
application/x-chess-pgn pgn  
application/x-cpio cpio  
application/x-csh csh  
application/x-director dcr dir dxr  
application/x-dvi dvi  
application/x-futuresplash spl  
application/x-gtar gtar  
application/x-hdf hdf  
application/x-httpd-php .php .php4 .php3 .phtml  
application/x-httpd-php-source .phps  
application/x-javascript js  
application/x-koan skp skd skt skm  
application/x-latex latex  
application/x-netcdf nc cdf  
application/x-pkcs7-crl .crl  
application/x-sh sh  
application/x-shar shar  
application/x-shockwave-flash swf  
application/x-stuffit sit  
application/x-sv4cpio sv4cpio  
application/x-sv4crc sv4crc  
application/x-tar .tgz tar  
application/x-tcl tcl  
application/x-tex tex  
application/x-texinfo texinfo texi  
application/x-troff t tr roff  
application/x-troff-man man  
application/x-troff-me me  
application/x-troff-ms ms  
application/x-ustar ustar  
application/x-wais-source src  
application/x-x509-ca-cert .crt  
application/xhtml+xml xhtml xht  
application/xml xml xsl  
application/xml-dtd dtd  
application/xslt+xml xslt  
application/zip zip  
audio/basic au snd  
audio/midi mid midi kar  
audio/mpeg mpga mp2 mp3  
audio/x-aiff aif aiff aifc  
audio/x-mpegurl m3u  
audio/x-pn-realaudio ram rm  
audio/x-pn-realaudio-plugin rpm  
audio/x-realaudio ra  
audio/x-wav wav  
chemical/x-pdb pdb  
chemical/x-xyz xyz  
image/bmp bmp  
image/cgm cgm  
image/gif gif  
image/ief ief  
image/jpeg jpeg jpg jpe  
image/png png  
image/svg+xml svg  
image/tiff tiff tif  
image/vnd.djvu djvu djv  
image/vnd.wap.wbmp .wbmp wbmp  
image/x-cmu-raster ras  
image/x-icon ico  
image/x-portable-anymap pnm  
image/x-portable-bitmap pbm  
image/x-portable-graymap pgm  
image/x-portable-pixmap ppm  
image/x-rgb rgb  
image/x-xbitmap xbm  
image/x-xpixmap xpm  
image/x-xwindowdump xwd  
model/iges igs iges  
model/mesh msh mesh silo  
model/vrml wrl vrml  
text/calendar ics ifb  
text/css css  
text/html .shtml html htm  
text/plain asc txt  
text/richtext rtx  
text/rtf rtf  
text/sgml sgml sgm  
text/tab-separated-values tsv  
text/vnd.wap.wml .wml wml  
text/vnd.wap.wmlscript .wmls wmls  
text/x-setext etx  
video/mpeg mpeg mpg mpe  
video/quicktime qt mov  
video/vnd.mpegurl mxu  
video/x-msvideo avi  
video/x-sgi-movie movie  
x-conference/x-cooltalk ice

输出页面

private void Page_Load(object sender, System.EventArgs e)

              {

                     try

                     {

                            string id = Request.QueryString["id"];

                            int ID = Int32.Parse(id);

                            byte[] imagebyte = //Get image data by image’s ID             

                            Response.ContentType = "image/gif"; 

                            Response.BinaryWrite( imagebyte );

                     }

                     catch(Exception Error)

                     {

                            Response.Write(Error.Message);

                     }   

              }

分享到:
评论

相关推荐

    Cybersecurity Incident Response

    “Effective incident response forms the criteria used to judge cybersecurity programs. Effective protection and detection measures do not matter if the response to an event falls short. Within days of...

    VUE 修复MOCKJS ResponseType BUG

    然而,在开发过程中,我们可能会遇到各种问题,其中之一就是在使用MOCKJS进行模拟数据时遇到的`ResponseType`错误。本文将深入探讨这个BUG及其解决方案。 首先,理解`ResponseType`的概念至关重要。在HTTP请求中,`...

    response设置编码 java

    response 设置编码 java 在 Java Web 开发中,设置 Response 的编码方式是非常重要的,因为它直接影响到浏览器对服务器响应的解析和显示。下面我们将详细讨论 Response 设置编码的三个方法,并分析它们之间的差异。...

    C#利用Response流将数据库数据导出成Excel

    C#利用Response流将数据库数据导出成Excel C#语言是一种功能强大且灵活的编程语言,广泛应用于各种软件开发领域。其中,数据导出功能是许多软件系统中必不可少的功能之一。在本文中,我们将探讨如何使用C#语言将...

    Response2000

    "Response2000"是一款专门用于混凝土结构截面非线性特性计算的专业软件。这款工具在工程领域,特别是建筑设计和结构分析中有着广泛的应用。它能够帮助工程师精确地理解和模拟混凝土结构在受力过程中的行为,从而进行...

    Jsp利用response.sendRedirect、cookie传参

    ### JSP中利用`response.sendRedirect`与Cookie进行参数传递 #### 概述 在Web开发中,特别是使用Java Server Pages(JSP)进行网站构建时,数据的传递是至关重要的。其中,`response.sendRedirect`方法和Cookie...

    digest 用户认证 response生成算法

    - response:用户凭证摘要响应值,是摘要算法加密后的结果。 以上参数共同构成了摘要认证响应的生成算法,通过这种算法,服务器能够验证客户端请求的有效性,而不会暴露用户凭证的明文信息。摘要认证使用MD5算法,...

    HttpClient 卡死 response 为 null - 帐前卒 - CSDN1

    然而,当`response`对象为`null`时,这可能表明以下几种情况: 1. **连接问题**:网络连接未建立或在请求过程中断开。检查网络配置,确保服务器地址正确且可访问。 2. **超时设置**:如果请求超时,`HttpClient`...

    jsp response.sendRedirect不跳转的原因分析及解决.docx

    ### jsp response.sendRedirect不跳转的原因分析及解决 #### 一、问题背景 在进行Web应用开发的过程中,经常需要使用到服务器端重定向的技术。在Java Server Pages (JSP) 技术中,`response.sendRedirect()` 是一...

    response和request(web开发技术第四章)

    在Web开发框架中,如Python的Django或Flask,或者Java的Spring MVC,`request`和`response`通常被封装成对象,便于开发者操作。通过`request`对象,开发者可以获取请求的参数、头信息,甚至可以读取POST请求的请求体...

    python使用response.read()接收json数据的实例

    result = response.read() result.decode('utf-8') jsonData = json.loads(result) 以上这篇python使用response.read()接收json数据的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多...

    request和response实现跳转和重定向的区别

    在处理用户操作时,我们常常需要对页面进行跳转或重定向,这通常通过`request`和`response`对象来实现。这两者在实现页面跳转时有明显的区别,下面将详细阐述它们的不同之处。 首先,我们了解`request`和`response`...

    Response-Headers详解

    ### Response-Headers详解 #### HTTP响应报头的基本概念与作用 HTTP响应报头是Web服务器向客户端(通常是浏览器)发送响应时附带的信息。这些报头提供了关于响应本身的元数据,如响应的内容类型、长度等,对于正确...

    response.setHeader问题

    response.setHeader 问题详解 Response.setHeader 问题是指在 Servlet 中使用 response 对象的 setHeader 方法来设置 HTTP 消息报头,以控制浏览器的缓存行为。本文将详细解释 response.setHeader 的作用、HTTP ...

    nginx优化之request_time 和upstream_response_time差别1

    本文将深入探讨两个关键的响应时间指标:`request_time` 和 `upstream_response_time`,以及它们在实际应用中的区别。 `request_time` 是Nginx记录的从开始接收客户端的第一个字节到完成写入日志(即发送完所有响应...

    Request和Response.txt

    ### Request和Response知识点详解 #### 一、概述 在Web开发中,`Request`与`Response`对象是非常核心且基础的概念。它们是客户端与服务器端交互的重要桥梁,用于处理HTTP请求与响应。本文将深入剖析这两个对象的...

    struts2获取response的方法

    以下是对"struts2获取response的方法"的详细说明。 1. **ActionSupport类的实现** Struts2中的Action类通常会继承自`org.apache.struts2.interceptor.StrutsPrepareAndExecuteInterceptor`或`...

    SCI发表_投稿信(Cover Letter)、催稿信、response letter、审稿意见书写、文章校样邮件回复等万能模板

    9、response letter万能模板1.docx 10、response letter万能模板1.doc 11、response letter万能模板2.doc 12、response letter万能模板3.doc 12、文章接受后邮件回复万能模板.docx 13、response letter万能模板4.doc...

    ASP.NET Core自定义中间件如何读取Request.Body与Response.Body的内容详解

    本文将深入探讨如何在自定义中间件中读取`Request.Body`和`Response.Body`的内容。 首先,`Request.Body`代表HTTP请求的主体部分,通常用于发送POST数据或文件上传。它是`Stream`类型的,可以读取请求的数据。在ASP...

    文件下载response.setHeader()下载中文文件名乱码问题解决办法.pdf

    文件下载response.setHeader()下载中文文件名乱码问题解决办法 本文主要讨论了文件下载时response.setHeader()下载中文文件名乱码问题的解决办法。该问题是由于 HTTP 消息头中的 Content-Disposition 头字段不正确...

Global site tag (gtag.js) - Google Analytics