I am using CancelAsyncPostback in an attempt to stop a page from loading. It actually works (the page wont get a postback) but the server keeps running, processing data I dont want processed until it gets done with a task I really didnt want done because I didnt realize how long it took
I tried adding a button to do a server transfer to "./Default.aspx" but it only transfered AFTER the processing was complete.
what I tried that didnt work like I thought it would
-
var prm = Sys.WebForms.PageRequestManager.getInstance();
-
function CancelAsyncPostBack() {
-
if (prm.get_isInAsyncPostBack()) {
-
prm.abortPostBack();
-
return false;
-
}
-
}
-
---etc---
-
function EndRequest(sender, args) {
-
var err = args.get_error();
-
if (err != null && err.name === 'Sys.WebForms.PageRequestManagerTimeoutException') {
-
args.set_errorHandled(true);
-
location.reload(true);
-
return;
-
}
-
if (postBackElement.id == 'Panel1Trigger') {
-
$get('UpdateProgress1').style.display = 'none';
-
}
-
}
-
---etc--
-
<ProgressTemplate>
-
Processing...
-
<input id="Button2"
-
type="button"
-
value="cancel"
-
onclick="CancelAsyncPostBack()"; />
-
</ProgressTemplate>
-
When I click on the cancel button the CancelAsync runs and then falls thru to the EndRequest. This does not actually stop the server from running. Surely there is some command I can use to signal to the server to exit the loop it is in?
Is there anything my C# web app can call to determine if the user ran that CancelAsync process?
Thanks for looking.