OutOfMemoryException when creating huge string in ASP.NET
When exporting a lot of data to a string (csv format), I get a OutOfMemoryException. What's the best way to tackle this? The string is returned to a Flex Application. What I'd do is export the csv to the server disk and give back an url to Flex. Like this, I can flush the stream writing to the disk. Update: String is build with a StringBuilder: StringBuilder stringbuilder = new StringBuilder(); string delimiter = ";"; bool showUserData = true; // Get the data from the sessionwarehouse List<DwhSessionDto> collection =_dwhSessionRepository.GetByTreeStructureId(treeStructureId); // ADD THE