c# - 文件流下载-自定义工具
2023-09-14 09:06:39 时间
//需要文件字节流、带后缀的文件名,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(); }
相关文章
- c#防止代码被反编译_C程序反编译
- 利用 C# 中的 FileSystemWatcher 制作一个文件夹监控小工具
- 通过C#来加载X509格式证书文件并生成RSA对象详解编程语言
- C#程序员经常用到的10个实用代码片段
- 用C#把文件转换为XML的代码
- C#中使用快速排序按文件创建时间将文件排序的源码
- C#使用正则表达式实例
- C#文件上传默认最大为4M的解决方法
- C#获取程序集版本、文件版本
- asp.net(c#)做一个网页数据采集工具
- C#中方法的详细介绍
- c#后台输出javascript语句示例程序
- c#使用资源文件的示例
- c#反射调用方法示例
- C#同步、异步远程下载文件实例
- C#使用iCSharpcode进行文件压缩实现方法
- C#中string和StingBuilder内存中的区别实例分析