I recently received a question asking how to deliver part of the web page to the client while allowing the server to finish its processing before delivering the rest.
The technique is relatively straightforward, but I thought I'd post a thread about it because until I went searching, I didn't know how to do it either.
The following code loops from 1 to 50 and sends each line of output to the client as it completes.
... Page_Load(){
for(int i = 0; i < 50; i++){
Response.Write("
currently at: " + i.ToString());
Response.Flush(); //send all buffer output to the client
System.Threading.Thread.Sleep(2000);
}
}

1 answers
Great idea jerry, I'm thinking of starting a code snippet section and this would be a great snippet.
answered 2 years ago by:
0
This post was imported from csharpfriends, if you have a similiar question please ask it again.
All previous members have been migrated, hope you enjoy the new platform!