简单下载,项目有需要,就搞了个下载
FileInfo fi= new FileInfo(路径);Response.Clear();Response.ClearContent();Response.ClearHeaders();Response.Buffer = true;Response.Charset = Encoding.UTF8.BodyName;Response.AppendHeader("Content-Disposition", "attachment;filename=" +名称 + ".xls");Response.AddHeader("Content-Length", fi.Length.ToString());Response.ContentEncoding = Encoding.UTF8;Response.ContentType = "application/vnd.ms-excel; charset=UTF-8";Response.WriteFile(fi.FullName);Response.Flush();Response.End();