此例子演示了如何从文件中获取二进制数据,然后如何使用 ASP.NET 和 C# 将该数据写出到浏览器中
private void Page_Load(object sender, System.EventArgs e) { Response.ContentType = "Application/msword"; string FilePath = MapPath("microsoft.doc"); Response.WriteFile(FilePath); Response.End(); }
以下是Response.ContenType 的所有值
application/acad |
*.dwg |
application/applefile |
|
application/astound |
*.asd *.asn |
application/dsptype |
*.tsp |
application/dxf |
*.dxf |
application/futuresplash |
*.spl |
application/gzip |
*.gz |
application/listenup |
*.ptlk |
application/mac-binhex40 |
*.hqx |
application/mbedlet |
*.mbd |
application/mif |
*.mif |
application/msexcel |
*.xls *.xla |
application/mshelp |
*.hlp *.chm |
application/mspowerpoint |
*.ppt *.ppz *.pps *.pot |
application/msword |
*.doc *.dot |
application/octet-stream |
*.bin *.exe *.com *.dll *.class |
application/oda |
*.oda |
application/pdf |
*.pdf |
application/postscript |
*.ai *.eps *.ps |
application/rtc |
*.rtc |
application/rtf |
*.rtf |
application/studiom |
*.smp |
application/toolbook |
*.tbk |
application/vocaltec-media-desc |
*.vmd |
application/vocaltec-media-file |
*.vmf |
application/xhtml+xml |
*.htm *.html *.shtml *.xhtml |
application/xml |
*.xml |
application/x-bcpio |
*.bcpio |
application/x-compress |
*.z |
application/x-cpio |
*.cpio |
application/x-csh |
*.csh |
application/x-director |
*.dcr *.dir *.dxr |
application/x-dvi |
*.dvi |
application/x-envoy |
*.evy |
application/x-gtar |
*.gtar |
application/x-hdf |
*.hdf |
application/x-httpd-php |
*.php *.phtml |
application/x-javascript |
*.js |
application/x-latex |
*.latex |
application/x-macbinary |
*.bin |
application/x-mif |
*.mif |
application/x-netcdf |
*.nc *.cdf |
application/x-nschat |
*.nsc |
application/x-sh |
*.sh |
application/x-shar |
*.shar |
application/x-shockwave-flash |
*.swf *.cab |
application/x-sprite |
*.spr *.sprite |
application/x-stuffit |
*.sit |
application/x-supercard |
*.sca |
application/x-sv4cpio |
*.sv4cpio |
application/x-sv4crc |
*.sv4crc |
application/x-tar |
*.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 *.troff |
application/x-troff-me |
*.me *.troff |
application/x-troff-ms |
*.me *.troff |
application/x-ustar |
*.ustar |
application/x-wais-source |
*.src |
application/x-www-form-urlencoded |
|
application/zip |
*.zip |
audio/basic |
*.au *.snd |
audio/echospeech |
*.es |
audio/tsplayer |
*.tsi |
audio/voxware |
*.vox |
audio/x-aiff |
*.aif *.aiff *.aifc |
audio/x-dspeeh |
*.dus *.cht |
audio/x-midi |
*.mid *.midi |
audio/x-mpeg |
*.mp2 |
audio/x-pn-realaudio |
*.ram *.ra |
audio/x-pn-realaudio-plugin |
*.rpm |
audio/x-qt-stream |
*.stream |
audio/x-wav |
*.wav |
drawing/x-dwf |
*.dwf |
image/cis-cod |
*.cod |
image/cmu-raster |
*.ras |
image/fif |
*.fif |
image/gif |
*.gif |
image/ief |
*.ief |
image/jpeg |
*.jpeg *.jpg *.jpe |
image/png |
*.png |
image/tiff |
*.tiff *.tif |
image/vasa |
*.mcf |
image/vnd.wap.wbmp |
*.wbmp |
image/x-freehand |
*.fh4 *.fh5 *.fhc |
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-windowdump |
*.xwd |
image/x-xbitmap |
*.xbm |
image/x-xpixmap |
*.xpm |
message/external-body |
|
message/http |
|
message/news |
|
message/partial |
|
message/rfc822 |
|
model/vrml |
*.wrl |
multipart/alternative |
|
multipart/byteranges |
|
multipart/digest |
|
multipart/encrypted |
|
multipart/form-data |
|
multipart/mixed |
|
multipart/parallel |
|
multipart/related |
|
multipart/report |
|
multipart/signed |
|
multipart/voice-message |
|
text/comma-separated-values |
*.csv |
text/css |
*.css |
text/html |
*.htm *.html *.shtml |
text/javascript |
*.js |
text/plain |
*.txt |
text/richtext |
*.rtx |
text/rtf |
*.rtf |
text/tab-separated-values |
*.tsv |
text/vnd.wap.wml |
*.wml |
application/vnd.wap.wmlc |
*.wmlc |
text/vnd.wap.wmlscript |
*.wmls |
application/vnd.wap.wmlscriptc |
*.wmlsc |
text/xml |
*.xml |
text/xml-external-parsed-entity |
|
text/x-setext |
*.etx |
text/x-sgml |
*.sgm *.sgml |
text/x-speech |
*.talk *.spc |
video/mpeg |
*.mpeg *.mpg *.mpe |
video/quicktime |
*.qt *.mov |
video/vnd.vivo |
*.viv *.vivo |
video/x-msvideo |
*.avi |
video/x-sgi-movie |
*.movie |
workbook/formulaone |
*.vts *.vtts |
x-world/x-3dmf |
*.3dmf *.3dm *.qd3d *.qd3 |
x-world/x-vrml |
*.wrl |