468,101 Members | 1,449 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,101 developers. It's quick & easy.

how do I stop server from running when I want to cancel out?

BeemerBiker
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

Expand|Select|Wrap|Line Numbers
  1. var prm = Sys.WebForms.PageRequestManager.getInstance();
  2.         function CancelAsyncPostBack() {
  3.             if (prm.get_isInAsyncPostBack()) {
  4.                 prm.abortPostBack();
  5.                 return false;
  6.             }
  7.         }
  8. ---etc---
  9.         function EndRequest(sender, args) {
  10.             var err = args.get_error();
  11.             if (err != null && err.name === 'Sys.WebForms.PageRequestManagerTimeoutException') {
  12.                 args.set_errorHandled(true);
  13.                 location.reload(true);
  14.                 return;
  15.             }
  16.             if (postBackElement.id == 'Panel1Trigger') {
  17.                 $get('UpdateProgress1').style.display = 'none';
  18.             }
  19.         }
  20. ---etc--
  21.             <ProgressTemplate>
  22.                 Processing...
  23.                 <input id="Button2" 
  24.                        type="button" 
  25.                        value="cancel" 
  26.                        onclick="CancelAsyncPostBack()"; />
  27.             </ProgressTemplate>
  28.  
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.
Sep 27 '09 #1
1 2171
Frinavale
9,735 Expert Mod 8TB
Sorry but there is no such command.

The CancelAsyncPostback is meant for just cancelling an Ajax Request from occurring...it isn't meant to cancel a request that has already been sent to the server.

There is no way that I know of that will cancel the server side process once it's going. Each individual request is a separate request...and therefore there is no "interrupting" or "stopping" a request that is being processed.
Sep 28 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Geoff | last post: by
5 posts views Thread by Ketta | last post: by
3 posts views Thread by Niyazi | last post: by
4 posts views Thread by David | last post: by
1 post views Thread by magic man via .NET 247 | last post: by
reply views Thread by Dirk Runge | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.