asp.net download excel file in IE6
I have been trying to have the user download an excel file via a download prompt. Everything works fine in firefox and IE7 + but it doesnt work in IE6. In IE6, it displays the name of the aspx page and downloads a blank page.
Here is my code Response.Clear(); string fileName = DateTime.Now.ToShortDateString() + "Leads.csv"; Response.Clear();
Response.AppendHeader("content-disposition", "attachment;filename=" + fileName); Response.ContentType = "application/vnd.ms-excel"; if (Session["LeadsSearchResults"] != null) { WriteLeads(Response.Output, GetTasks((IList)Session["LeadsSearchResults"])); } Response.Flush(); Response.End();
您需要从文件名中删除斜杠。
链接地址: http://www.djcxy.com/p/46858.html