Sounds like the issue here was the response buffer filling up. Either of these solutions should work:
- Disable buffering by adding
Response.Buffer = False
as the first line of code. - Leave buffering enabled but call
Response.Flush()
at certain intervals to flush the buffer.