I am currently developing an asp application with c# .net. I have to query a large(10GB) SQLite database and write the data as CSV format to HTTP response.
I am doing this
/*query database, use string builder to create a csv*/
Response.ContentType = "text/plain";
Response.AddHeader("Content-Length", result.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment; filename=\"Data.csv\"");
Response.Write(result);
Response.Flush();
Which works file with small amount of data. But when the file size increases I get a OutOfMemoryException. I think using StringBuilder to create a string is causing the issue. I can not figure out any way to solve the issue. Can anyone please help me resolve this?
I actually solved the problem.
I did this