System.IO.FileInfo DownloadFile = new System.IO.FileInfo(Server.MapPath("~/Files/StaffTemp/员工导入模板.xls"));
string UserAgent = Request.ServerVariables["http_user_agent"].ToLower();
string FileName = "员工导入模板.xls";
if (UserAgent.IndexOf("firefox") == -1)
FileName = HttpUtility.UrlEncode(FileName, Encoding.UTF8);
Response.AppendHeader("content-type", "application/octet-stream");
Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);
Response.WriteFile("~/Files/StaffTemp/员工导入模板.xls");
Response.Flush();
Response.End();
兼容所有浏览器的下载语句
最新推荐文章于 2021-06-17 17:43:26 发布