If you just want to return some data from the database to a text file that will be downloaded to the user's local computer, create an Action in the Controller , as in this example:
using System.IO; using System.Text; public class SomeController {
then you can create an ActionLink for this action on the View , which will lead to the download of the file:
@Html.ActionLink("Download Text File", "CreateFile", "SomeController ")
I hope this helps!
mik-t
source share