下载文件输出设置

[1]Response.ContentType = "application/vnd.ms-excel";
   Response.AddHeader("Content-Disposition", "inline; filename=" +HttpUtility.UrlEncode (fileName,System.Text.Encoding.UTF8));

[2]Response.ContentType = "application/octet-stream";
   Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));

[1]将直接在IE中将Excel文件打开,而[2]将弹出是否保存对话框

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