MVC FileResult cannot set filename
Hi everyone,
I'm trying to add a simple CSV export button to an MVC widget. Everything is working as expected, with the exception of the downloaded file's name. When I click the button, the file is sent to my browser, but the filename is blank. Does anyone have an idea what the problem could be? Relevant code is below. I'm using the latest version of Sitefinity, 7.2.
public
FileResult Download()
var attendees = _meetingService.GetMeetingAttendees(MeetingID);
using
(var writer =
new
StringWriter(
new
StringBuilder()))
using
(var csvHelper =
new
CsvHelper.CsvWriter(writer))
csvHelper.Configuration.RegisterClassMap<AttendeeCsvMap>();
csvHelper.WriteRecords<MeetingAttendee>(attendees);
return
File(Encoding.UTF8.GetBytes(writer.ToString()),
"text/csv"
,
"CL2015Attendees.csv"
);
Hello Josh,
Thank you for the details. I succeeded in reproducing the issue and I have added it in our tracking system, so you can be updated as soon as it is fixed. You can track the progress of the issue here:
I have added you to the followers of the item so you could receive notifications if the status of the items is changed. If you do not want to receive notifications your could unfollow the item by clicking "Following the item". Once the problem is fixed the item will be marked as Done.
Excuse us for the inconvenience.
Thanks Elena, I appreciate it and hope it's an easy fix.
Thanks,
Josh
Hi Josh,
This is just an update to inform you that we have already fixed this issue, so it is available in today’s internal build 7.2.5312.0. Internal builds are available in your account under Products & Subscriptions -> Latest internal builds. Select a product and version and you will be able to review the available internal builds.
Regards,
Elena Ganeva
Telerik
Hi Josh,
This is just an update to inform you that we have already fixed this issue, so it is available in today’s internal build 7.2.5312.0. Internal builds are available in your account under Products & Subscriptions -> Latest internal builds. Select a product and version and you will be able to review the available internal builds.
Works like a charm, thanks Elena!