+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / MVC FileResult cannot set filename

MVC FileResult cannot set filename

6 posts, 1 answered
  1. Josh
    Josh avatar
    16 posts
    Registered:
    15 May 2012
    08 Oct 2014
    Link to this post

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

  2. Elena Ganeva
    Elena Ganeva avatar
    36 posts
    Registered:
    20 Jul 2016
    09 Oct 2014
    Link to this post

    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
     
  3. Josh
    Josh avatar
    16 posts
    Registered:
    15 May 2012
    09 Oct 2014 in reply to Elena Ganeva
    Link to this post

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

    Thanks,
    Josh

  4. Elena
    Elena avatar
    3 posts
    Registered:
    12 Nov 2013
    10 Oct 2014
    Link to this post

    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

  5. Elena Ganeva
    Elena Ganeva avatar
    36 posts
    Registered:
    20 Jul 2016
    10 Oct 2014
    Link to this post

    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
     
    Answered
  6. Josh
    Josh avatar
    16 posts
    Registered:
    15 May 2012
    10 Oct 2014 in reply to Elena Ganeva
    Link to this post

    Works like a charm, thanks Elena!

6 posts, 1 answered