Try our conversational search powered by Generative AI!

Gadget to create a CSV file

Vote:
 

Hi,

Would anyone have a controller example that prompts for a file download from a string? I'm trying function that returns a System.Web.Mvc.FileContentResult, but the contents get displayed in the gadget instead of getting downloaded.

Here is the return line of the function:

                return File(new System.Text.UTF8Encoding().GetBytes(sb.ToString()), "text/plain",
                     String.Format("{0}_{1}.{2}", StoreExportBase.GetExportFriendlyName(t), DateTime.Now.ToString("dd_mm_yyy_hh-ss_tt"), extension)
                     );

Thanks,

Brad

#86760
May 29, 2014 21:10
Vote:
 
#86766
May 30, 2014 9:41
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.