Response.TransmitFile 下载文件

string fileName="",filePath="";

..... 

 Response.Clear();      

 Response.Buffer = true;

 Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);     

 Response.ContentType = "application/unknow";       

 Response.TransmitFile(filePath);            

 Response.End();

fileName为下载后显示的文件名

filePath服务器上的文件的绝对路径

原文地址:https://www.cnblogs.com/zhftyy/p/4213020.html