All,
In my application i allow users to download a csv file from the App. When a user clicks on the Download file link , they see the Download file dialog box. My problem is that some o f the files opens as an HTML document.This happens intermittently.This is the code am using.Can anyone please help?
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/octet-stream";
Response.AppendHeade开发者_StackOverflowr("Content-Disposition"
, "attachment; filename=" + sf.FileName);
Response.OutputStream.Write(sf.Data, 0, sf.Data.Length);
Response.Flush();
Response.Close();
I tried Response.End()
insted of Response.Flush();
but didnt help.
Any help would be greatly appreciated
THanks
RJ
text/csv is more appropriate.
see: Response Content type as CSV
精彩评论