I need to implement download button in my View and when user click i need to read some records from database create a file and download.
var stream = new MemoryStream();
stream.Position = 0;
var response = new HttpResponseMessage(HttpStatusCode.OK);
response.Content = new StreamContent(stream);
return response;
This is the code that I have for now, but I don't know how to write some data to it and how to convert to txt file.
Do i need to create it before and store on the server and here just to read it?