R – asp.net download excel file in IE6

content-dispositiondownloadexcelinternet-explorer-6

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();

Best Answer

You need to remove slashes from the file name.