Using ASP to implement Web page calls Doc attached Response.ContentType detail list _ Application Tips

Source: Internet
Author: User
Tags gtar
Microsoft has an article: HTTP://SUPPORT.MICROSOFT.COM/KB/193998/ZH-CN, with Doc Read and display binary data, "How to read binary file", no test, lazy compiler DLL
ASP program:
<%
Response.buffer=true
Response.contenttype= "Application/x-msexcel"
Dim Vntstream
Set Omyobject=server.createobject ("Myobject.binread") ' This component is described later
Vntstream=omyobject.readbinfile ("C:\temp\tempxls.xls")
Response.BinaryWrite (Vntstream)
Set omyobject.nothing
Response.End
%>

Control code:
The first step: Create an ActiveX DLL Project in VB
Step Two: Change the project name to MyObject
Step Three: Change the class name to Binread
Step Fourth: Write the following code in the class module
Function Readbinfile (ByVal bfilename as String)
Dim FL as Long
Dim FileNum as Byte
Dim Binbyte () as String

FileNum = FreeFile
Open bfilename for Binary Access Read as #FileNum

FL = FileLen (bfilename)
ReDim Binbyte (FL)

Get #FileNum, Binbyte

Close #FileNum
Readbinfile = Binbyte
End Function
Fifth Step: Disk
Sixth step: Compiling


My code, I do not know why can be saved, online is not open:

<%
Response.Buffer = TRUE
Response. Contenttype= "Application/msword"
Server. Execute ("111.doc")
%>

Report:

ASP:Response.ContentType Detailed list
Different contenttype affect what the client sees. The default contenttype is text/html, which is the Web page format.
Code such as:

<% Response. ContentType = "text/html"%>
<!--#i nclude virtual= "/contenttype.html"-->

is displayed as a Web page, while the

<% Response. ContentType = "Text/plain"%>
<!--#i nclude virtual= "/sscript/contenttype.html"-->

The HTML source code is displayed.

The following are some commonly used 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"-->


The following is a more detailed 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 '
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.