Are you trying to do multi-threading on the server? What I'd recommend is in your client side javascript turn on a please wait message before posting to the server. Then on the client side when your done posting you turn the message off.
Without knowing more about your actual setup I can't help much further, but last time I implemented this I did something along these lines:
Assume we have a div called PrintLoadingPanel using JQUERY I set the div to display and take over the window:
$("#printLoadingPanel")
.css({display:"block",top:"0px",left:"0px",height:screen.availHeight});
I then will start a timer with a 1/2 second interval which will start checking if we are done printing. I'm only generating and downloading small PDF's so i needed a quicker response. If your report is really slow you might want to tweak this:
window.setTimeout(checkIfDoneDownload,500);
Then my CheckIfDoneDownload function hits the server and checks if we finished generating the file and downloaded it. I am using JQUERY here again to call an AJAX enabled WCF service. You could substitute this with PageMethods or any other way to callback to the server.
function checkIfDoneDownload()
{
$.ajax({
type: "POST",
url: "../Services/Utilities.svc/IsPrintDownloadDone",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
if (msg.d)
{
$("#printLoadingPanel").css("display","none");
}
else {window.setTimeout(checkIfDoneDownload,500);}
},
error: function (xhr, textStatus, errorThrown) {
if (xhr.status==12030) {checkIfDoneDownload();}
}
});
}
Now on the server side, I am generating my downloads via an HTTP Handler. Essentially the first thing it does is set a session level flag to false, then the last thing it does is set it back to true. My check if done service just returns the value of the flag.