日期:2014-05-17 浏览次数:20438 次
public void DownLoad(string path,string filename)
{
if (System.IO.File.Exists(path))
{
FileInfo file = new FileInfo(path);
Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //解决中文乱码
Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(filename)); //解决中文文件名乱码
Response.AddHeader("Content-length", file.Length.ToString());
Response.ContentType = "appliction/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
}