实现代码如下:

    if (context.Request.UserAgent.ToLower().IndexOf("msie", System.StringComparison.Ordinal) > -1)//IE浏览器
 {
     context.Response.AddHeader("content-disposition", "filename=" + HttpUtility.UrlEncode(fileName));
 }
 if (context.Request.UserAgent.ToLower().IndexOf("firefox", System.StringComparison.Ordinal) > -1)//firefox浏览器
 {
     context.Response.AddHeader("content-disposition", "attachment;filename=\"" + fileName + "\"");
 }
 else//其他浏览器
 {
     context.Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
 }
 context.Response.ContentType = "application/x-xls";  

以上就是【下载文件个别浏览器文件名乱码解决办法】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论