文件下载乱码

 string downfile = filename;
                if (Request.UserAgent.ToLower().IndexOf("msie") > -1)
                {
                    downfile = HttpUtility.UrlPathEncode(filename);
                }

                if (Request.UserAgent.ToLower().IndexOf("firefox") > -1)
                {
                    Response.AddHeader("Content-Disposition", "attachment;filename=\"" + downfile + "\"");
                }
                else
                {
                    Response.AddHeader("Content-Disposition", "attachment;filename=" + downfile);
                }
                Response.ContentEncoding = System.Text.Encoding.UTF8;
原文地址:https://www.cnblogs.com/wlwjc/p/2854934.html