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();
                    }

  • 相关阅读:
    git相关整理
    cookie、sessionStorage和localStorage
    AJAX学习笔记
    json web token
    加密算法
    单点登陆
    给手机网络添加手动代理
    oracle数据库索引
    类加载器
    类加载过程
  • 原文地址:https://www.cnblogs.com/johnblogs/p/6709074.html
Copyright © 2011-2022 走看看