Ask the browser not to wait for more content during processing

How can I notify the browser not to expect any content to flow down the line? It's like the server is saying, "I got what I need, you don't have to wait for me to finish processing the page."

I have a server side task that is triggered when a certain page is hit. The task may take a long time, but the displayed HTML will always be the same, that is, as a "Thank you for submitting the task" message.

I'm considering starting a new thread to process the task, but I believe there should be a more elegant solution where you just send the correct headers / instructions to the browser and then continue processing.

Any ideas?

0


source to share


1 answer


This will send your message to the browser:

Response.Flush()

      



However, I believe that the responsibility for notifying the client that the transfer is complete is carried out by IIS, which it will not do until the ASP.NET engine completes its part of the request and returns control to IIS. Your best bet is to start a new thread, which shouldn't cause any problems since the request stream ends almost immediately after starting a new one ... you still only have one thread for each request.

+2


source







All Articles