I am generating and excel file using the OpenXML library and sending it to the user. It works very well with Chrome and IE but when i tried it with Firefox i came upon a problem.
When saving the file using FF i get a File with no extension When opening the file using FF it works like a charm :(
I am using the following function to send the stream to the user.
public static void SendToClient(Byte[] stream, string fileName)
{
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
HttpContext.Current.Response.BinaryWrite(stream);
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + fileName + ".xlsx");
HttpContext.Current.Response.AddHeader("content-length", stream.LongLength.ToString());
HttpContext.Current.Response.End();
}
and calling it like this:
_ExcelReports.SendToClient(excelUtil.ExportToExcel(excelWorkBook), projectName + " Resources");
Even weirder, FF download dialog recognizes the file, like in screenshot:
Now for the completed download: