public void DownloadExcel(HttpContext context )
{
string fileName = "值班人员信息表模板.xlsx";//客户端保存的文件名
System.Web.HttpServerUtility server = System.Web.HttpContext.Current.Server;
string filePath = server.MapPath(@"~/template/muban.xlsx");//路径
System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePath);
context.Response.Clear();
context.Response.ClearContent();
context.Response.ClearHeaders();
context.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName));
context.Response.AddHeader("Content-Length", fileInfo.Length.ToString());
context.Response.AddHeader("Content-Transfer-Encoding", "binary");
context.Response.ContentType = "application/ms-excel";
context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
context.Response.WriteFile(fileInfo.FullName);
context.Response.Flush();
context.Response.End();
}