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

        }

  • 相关阅读:
    常用数据结构之字符串
    c++知识点总结--友元&运算符重载
    c++知识点总结-模板特化
    c++知识点总结--new的一些用法
    linux socket c/s上传文件
    STL之算法使用简介
    【bzoj2733】 HNOI2012—永无乡
    【bzoj3132】 Sdoi2013—森林
    【bzoj1483】 HNOI2009—梦幻布丁
    【bzoj3091】 城市旅行
  • 原文地址:https://www.cnblogs.com/umlzhang/p/3810103.html
Copyright © 2011-2022 走看看