码迷,mamicode.com
首页 > Web开发 > 详细

asp.net 文件下载显示中文名称

时间:2014-06-27 00:58:18      阅读:356      评论:0      收藏:0      [点我收藏+]

标签:code   http   tar   ext   get   文件   

      

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

    }

asp.net 文件下载显示中文名称,布布扣,bubuko.com

asp.net 文件下载显示中文名称

标签:code   http   tar   ext   get   文件   

原文地址:http://www.cnblogs.com/umlzhang/p/3810103.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!