MVC FileResult cannot set filename

Posted by Community Admin on 04-Aug-2018 22:14

MVC FileResult cannot set filename

All Replies

Posted by Community Admin on 08-Oct-2014 00:00

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");
        
    

Posted by Community Admin on 09-Oct-2014 00:00

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:

http://feedback.telerik.com/Project/153/Feedback/Details/139933-mvc-mvc-fileresult-doesnt-set-filename

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.

Regards,
Elena Ganeva
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 09-Oct-2014 00:00

Thanks Elena, I appreciate it and hope it's an easy fix.

Thanks,
Josh

Posted by Community Admin on 10-Oct-2014 00:00

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

Posted by Community Admin on 10-Oct-2014 00:00

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.0Internal 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
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 10-Oct-2014 00:00

Works like a charm, thanks Elena!

This thread is closed