zoukankan      html  css  js  c++  java
  • asp.net 文件下载显示中文名称

          

    protected void Page_Load(object sender, EventArgs e)
        {
            string guid = Request.QueryString["GUID"];
            string sql = "select XSMC,FJMC,LJ from T_AQGL_FJ where GUID='" + guid + "'";
            CX.DBGetResult dbgr = new CX.DBGetResult(CX.AppInfo.DBMS, CX.AppInfo.ConStr);
            DataTable table = dbgr.GetDataTable(sql);
            string xsmc = table.Rows[0]["XSMC"].ToString();
            string fjmc = table.Rows[0]["FJMC"].ToString();
            string lj = table.Rows[0]["LJ"].ToString();
            HttpResponse _Response = HttpContext.Current.Response;
            FileInfo fileInfo = new FileInfo(Server.MapPath(lj));
            _Response.Clear();
            _Response.ClearHeaders();
            _Response.Buffer = false;
            _Response.ContentType = "application/octet-stream";
            _Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(xsmc, System.Text.Encoding.UTF8));
            _Response.AppendHeader("Content-Length", fileInfo.Length.ToString());
            _Response.WriteFile(fileInfo.FullName);
            _Response.Flush();
            _Response.End();

        }

  • 相关阅读:
    AWTK-MVVM:用 C 语言实现 Model
    MTU1500情况下,发送1460和1448长度数据
    linux mtu =1500情况下tcpdump抓包分析
    自己总结的pycharm超常用快捷键
    ICMP协议是IP层协议
    IP 分段
    ubuntu18.04安装中文输入法
    tcp 窗口大小
    flask学习笔记(二)
    开始学习前的环境安装
  • 原文地址:https://www.cnblogs.com/umlzhang/p/3810103.html
Copyright © 2011-2022 走看看