This example creates csv data in a string buffer to download as a csv file. In your MVC controller method, set the Response properties to indicate the Content Type as text/csv, set the content length and file name that will be downloaded to the user's browser as an attachment.
Write the string data to the response, then close and end the response.
The user will see a csv file download in their browser. When they open the csv file, their associated program (such as Excel) will open the file.