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

        }

  • 相关阅读:
    java 23种设计模式 深入理解
    ORACLE 一条记录 某字段值以';'拆分为多条记录
    rabbitmq集群故障恢复
    ORACLE 时间加减操作
    Asp.net MVC Razor输出字符串方法(js中嵌入razor)
    C# ToString() 数据格式
    DOM的整个知识体系
    EF 连接模式
    EF Code First 数据库连接方式
    使用border实现提示框的
  • 原文地址:https://www.cnblogs.com/umlzhang/p/3810103.html
Copyright © 2020-2023  润新知