private void DownloadFile(string filepath)
{
string filename = filepath;
string name = filename.Substring(filename.LastIndexOf("\\") + 1);
System.IO.FileInfo file = new System.IO.FileInfo(filename);
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(name, System.Text.Encoding.UTF8));
//Response.TransmitFile(filename);
Response.Filter.Close();
Response.WriteFile(filename);
Response.End();
}
注意:filepath为要下载文件的路径