asp.net

位置:IT落伍者 >> asp.net >> 浏览文章

asp.net下载文件


发布日期:2021年03月29日
 
asp.net下载文件

SystemIOFileInfo file = new SystemIOFileInfo(pstrFilePath);

if (fileExists)

{

ResponseClear();

ResponseCharset = GB;

ResponseContentEncoding = SystemTextEncodingUTF;

ResponseAddHeader(ContentDisposition attachment;filename= + ServerUrlEncode(fileName));

ResponseAddHeader(ContenLength fileLengthToString());

ResponseContentType = application/msexcel;

ResponseWriteFile(fileFullName);

ResponseEnd();

}

下面是更详细的ContentType

ez => application/andrewinset

hqx => application/macbinhex

cpt => application/maccompactpro

doc => application/msword

bin => application/octetstream

dms => application/octetstream

lha => application/octetstream

lzh => application/octetstream

exe => application/octetstream

class => application/octetstream

so => application/octetstream

dll => application/octetstream

oda => application/oda

pdf => application/pdf

ai => application/postscript

eps => application/postscript

ps => application/postscript

smi => application/smil

smil => application/smil

mif => application/vndmif

xls => application/vndmsexcel

ppt => application/vndmspowerpoint

wbxml => application/vndwapwbxml

wmlc => application/vndwapwmlc

wmlsc => application/vndwapwmlscriptc

bcpio => application/xbcpio

vcd => application/xcdlink

pgn => application/xchesspgn

cpio => application/xcpio

csh => application/xcsh

dcr => application/xdirector

dir => application/xdirector

上一篇:asp.net程序中如何自动生成姓名拼音

下一篇:ASP.NET2.0 HiddenField控件