SharePoint 2013 on premises in use.
We have a report that has been generated by a workflow and stored in a sharepoint list. It has been failing due to the size of the reports. My requirement is to maintain the same end user experience to initiate the creation of the report, that is clicking a quicklaunch link. I am hoping to do the minimal amount of work in SharePoint and I'm not sure this is the best way to go about doing this.
The data for the report is on a seperate server and is pulled into my code via a Stored Procedure.
I have created an Application page which takes a start and end date and passes these to the StoredProc. The code uses a SqlDataReader object which I then loop through, checking for nulls and adding commas to produce a csv string. A csv is good enough for the final output but I'm wondering how to get this as a file or if I can avoid doing that and get this to the end user as a csv some other way?
I hope what I'm doing makes sense. Basically I need to create a csv on the server and force a download for my user when it is done. Is this possible or should I look at adding the output to a Sharepoint list and letting the end user export from the list? ANother way maybe?