zoukankan      html  css  js  c++  java
  • .NET将服务器文件导出

        导出文件:
                    string filePath = Server.UrlDecode(filePath);
                    if (File.Exists(filePath))
                    {
                        FileInfo fi = new FileInfo(filePath);
                        Response.Clear();
                        Response.ClearHeaders();
                        Response.Buffer = false;
                        Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(Path.GetFileName(filePath), System.Text.Encoding.UTF8));
                        Response.AppendHeader("Content-Length", fi.Length.ToString());
                        Response.ContentType = "application/octet-stream";
                        Response.WriteFile(filePath);
                        Response.Flush();
                        Response.End();
                    }

  • 相关阅读:
    Synchronized和Lock的实现原理和锁升级
    如何禁止CPU指令重排
    MESI缓存一致性
    归并排序
    强软弱虚四种引用和ThreadLocal内存泄露
    VINS-Mono代码分析与总结(完整版)
    IMU误差模型与校准
    小感
    K8S conul部署
    Centos Consul集群及Acl配置
  • 原文地址:https://www.cnblogs.com/johnblogs/p/6709074.html
Copyright © 2011-2022 走看看