标签:
FileInfo file = new FileInfo(path + "../../../File/myexcel.xls");//路径 Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //解决中文乱码 Context.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode("myexcel.xls")); //解决中文文件名乱码 Context.Response.AddHeader("Content-length", file.Length.ToString()); Context.Response.ContentType = "application/vnd.ms-excel";//MIME类型 Context.Response.WriteFile(file.FullName); Context.Response.End();
以上为文件输出的代码,适当修改仅供参考。
标签:
原文地址:http://www.cnblogs.com/WZH75171992/p/4523819.html