Gosh man !! 1. Why are you expecting us to read *soo much* (unformatted) code. Please read the Group welcome message for a clue on posting rules.
2. Why so much repeated code ? If you have nice functions like "createTheHeader()" and "createTheTail()", why not create another nice function (such as "WriteTheStupidFile") to write the file contents to the HTTP response stream and call that when needed. 3. Are you really looping until the DataReader has no more records ? Why does the "overflow" condition exist at all ? I can envision two loops here : a) Outer loop: While the DataReader.Read() returns true. b) Inner loop: While record count <= 50. The counter is set to 0 at the beginning of this loop. 4. Why Clear() the Response before writing to the stream ? Why clear headers ? Why set Cacheability within a loop when it is not subject to change ? Why End() the response, instead of simply Flush()-ing it, even when you're probably going to send more files ? [The last one is analogous to a bartender padlocking up the bar and going home after serving every single customer. Then returning and reopening it when the next round of drinks is ordered.] Glancing at the code, I think the problem is either in the loop counters or in the Response being cleared. Apologies for asking so many questions. Am feeling inquisitive tonight! :-) On Sep 2, 6:44 pm, Iain <[email protected]> wrote: > Hi All > > I hope someone can help as I am stumped. >
