文件下载乱码

 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;

 

你可能感兴趣的:(文件下载)