复制代码 代码如下:
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";
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";
标签:
下载,文件名乱码
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“下载文件个别浏览器文件名乱码解决办法”评论...