The following headers work on IE but not on FF
<%@ Page Language="C#" ContentType="text/csv" Inherits="System.Web.Mvc.ViewPage"%>
<% Response.AddHeader("Content-Disposition", "filename=report.csv;attachment"); %>
In FF the suggested name in FF appears as "report" without the extension.
I am currently using code that looks like this:
In my daily work - and that works just fine. Also are you sure this is not your OS or anything that has the "Hide extensions for known file types"-option enabled? (I know Windows have this option and it drives me crazy)
Recently i faced this issue too, finally got the solution
To make It work correctly in firefox, make sure in file name Quotes are placed correctly and with no Spaces in file name
so here is the sample example to do basic test
This will work:
This also will work:
This will not work in firefox
References used this , this, this and this
Thanks to all whose post's helped somehow.
Hope it may help someone.
try "attachment; filename=\"report.csv\""
(i.e. with quoted filename)This question about CSV generation helped me when I needed to implement CSV generation and download: How do I best generate a CSV (comma-delimited text file) for download with ASP.NET?
filename
is just an parameter of Content-Dispostion. So you have to swap both: