//需要文件字节流、带后缀的文件名,mine类型
public static void exportFile(byte[] data, string fileName, string mine) { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Charset = "utf-8"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); HttpContext.Current.Response.ContentType = mine; HttpContext.Current.Response.BinaryWrite(data); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); }
标签:string,自定义,c#,mine,Current,HttpContext,Response,下载 From: https://www.cnblogs.com/c2g5201314/p/17198180.html