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浏览器
{
コンテキスト。 Response.AddHeader("content-disposition", "attachment;filename="" fileName "");
}
else//その他浏览器
{
context.Response.AddHeader(" content-disposition", "attachment;filename=" fileName);
}
context.Response.ContentType = "application/x-xls";