Exported CSV download stuck in firefox
I'm exporting a CSV to firefox using the following code:
string csv = dataTable.ToCSV();
Response.ClearContent();
Response.AddHeader("Content-disposition", "attachment;filename=solicitud.csv");
Response.AddHeader("Content-length", (Encoding.Unicode.GetBytes(csv).Length).ToString());
Response.ContentType = "application/excel";
Response.ContentEncoding = Encoding.Unicode;
Response.Write(csv);
Response.End();
However, firefox get stucked in "starting" when downloading the files, my guess is that firefox keeps waitin开发者_JAVA技巧g to receive more bytes, this only happens in firefox, IE works fine, Am I missing a header or do you see anything wrong with the code?
Instead use TransmitFile
Writes the specified file directly to an HTTP response output stream without buffering it in memory.
精彩评论