tags:

views:

14

answers:

0

I have a fairly long process running in a standard postback. Then I have the following page method to return progress to a repeating JavaScript function that is supposed to report on progress.

My simple page method:

[WebMethod]
public static int GetProgress()
{
    return (int)(HttpContext.Current.Session["ActivationResources.ImportProgress"] ?? 0);
}

My clientside script:

function startProgress() {
    window.setInterval(updateImportProgress(), 500);
}

var importProgress = 0;
function updateImportProgress() {
    //debugger;
    PageMethods.GetProgress(function (result, response, context) {
        if (result == importProgress) {
            $("#messageLabel").append(" .");
        }
        else {
            $("#messageLabel").html("Busy importing resources - " + result + "%");
        }
        importProgress = result;
    });
}

The updateImportProgress function is called, but Firebug reports that the POST for GetProgress is 'aborted'. Why could this be? I suspect that this is because the call to the static method is blocked by the actual executing method whose progress I am trying to monitor. A breakpoint in the GetProgress method is never hit.