zoukankan      html  css  js  c++  java
  • asp.net 服务器端下载文件

    System.IO.FileInfo file = new System.IO.FileInfo(path);
                    Response.Clear();
                    Response.Charset = "GB2312";
                    Response.ContentEncoding = System.Text.Encoding.UTF8;
                    // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(name));
                    // 添加头信息,指定文件大小,让浏览器能够显示下载进度
                    Response.AddHeader("Content-Length", file.Length.ToString());
                    Response.ContentType = "application/octet-stream";
                    // 把文件流发送到客户端
                    Response.WriteFile(file.FullName);
                    // 停止页面的执行
                    Response.End();

    本文使用Blog_Backup未注册版本导出,请到soft.pt42.com注册。

  • 相关阅读:
    linux 查看安装软件位置(持续跟新)
    POJ 3661 Running (DP思想)
    stringstream的用法
    关于实验室搬家
    POJ 搜索(2)
    Treap的插入删除实现
    碰到一道不错的扩展欧几里德题目 whu 1338
    SRM 144
    关于无向图双连通问题
    POJ 动态规划(2)
  • 原文地址:https://www.cnblogs.com/zjypp/p/2319513.html
Copyright © 2011-2022 走看看