I have a database operation that merges a large amount of records and takes several minutes to complete. What is the best method to handle an async operation and relay the results back to the user without timing out the browser.
It is not very easy. You will need a few things (the following is what I would do, but it is not the only way):
async page
create an additional table that records the state of async SQL commands. The table will need a [guid] column and a [IsComplete] column (this guid identifies the async SQL you are about to issue, isComplete records whether it is completed)
insert a record to the above table (generate guid and insert), issue async SQL command (with guid as state), and return the guid back to user's browser.
What the async SQL command will need to do when it finishes is to update the [IsComplete] to true. So, don't forget to send the guid to the async SQL command as the "state".
Since all actions are async, user will not have to "wait" (browser does not hang)
then, use the timer control + Ajax to check the IsComplete column. When it finishes (true), you will do whatever you want to notify the user (assuming the user does not leave the page yet).