views:

534

answers:

2

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

+1  A: 

You need to remove slashes from the file name.

paulwhit
A: 

Thanks, Pulwhit!

Removing slashes from the file name really works!!!

Eugene Vasylyev