I want to create a backend widget in Sitefinity to export my dynamic module content to a csv file. I have referred to this post, but instead of usercontrol I have used MVC Widget. It triggers the download but instead of returning a csv file with name mentioned in content-disposition header, it returns a file automatically named, and contains complete html along with file content. Is it due to the fact that a lot of changes are there regarding MVC in Sitefinity 9, because I have done this before in maybe 6 or 7 version. What should be done to accomplish this?
Instead of writing directly to response, I changed my approach and used StreamWriter instead, now HTML is not written into the file but still file name and extension mentioned in content-disposition header are not applied, below is my code.
//Content Fetch logic
var sw =
"C1, C2, C3, C4"
var children = parentContent.GetChildItems(childType);
WriteInfo(ViewModel model, StreamWriter sw)
StringBuilder stringBuilder =
//Create string of comma separated output values from model