Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Can I cancel a running server page from the browser?

Reply
Thread Tools

Can I cancel a running server page from the browser?

 
 
Larry Woods
Guest
Posts: n/a
 
      08-11-2003
I have a server page that has served an HTML page with a "Cancel" button on
it, BUT this server page has not completed and is running a 15-30 second
process before it completes. I want the browser user to be able to
terminate the page before the server process has finished. What I tried was
an onClick event that issued a "location.href..." in hopes that this would
load this referenced page, etc. but I have found that the browser waits
until the server process had compled before executing the "location.href".
Is there some way that I can "signal" the server to stop processing so that
I can go to the "location.href" page; or is there some other way?

TIA,

Larry Woods


 
Reply With Quote
 
 
 
 
Dave Anderson
Guest
Posts: n/a
 
      08-11-2003
"Larry Woods" wrote:
>
> I have a server page that has served an HTML page with a "Cancel"
> button on it, BUT this server page has not completed and is running
> a 15-30 second process before it completes. I want the browser user
> to be able to terminate the page before the server process has
> finished...
> ...Is there some way that I can "signal" the server to stop
> processing so that I can go to the "location.href" page; or is there
> some other way?


You cannot directly cancel the request. The best you can do is have the ASP
process constantly monitor some independent entity (a session variable or a
record in a DB, for example), continuing only if some prearranged condition
is met. The cancel request would still be independent of the original
request, but this should be possible in principle.


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.




 
Reply With Quote
 
 
 
 
Larry Woods
Guest
Posts: n/a
 
      08-11-2003
Thanks, Dave.

What would be the best way to set a Session variable for the browser? A
popup window ( 0 x 0 )?

TIA,

Larry

"Dave Anderson" <> wrote in message
news:...
> "Larry Woods" wrote:
> >
> > I have a server page that has served an HTML page with a "Cancel"
> > button on it, BUT this server page has not completed and is running
> > a 15-30 second process before it completes. I want the browser user
> > to be able to terminate the page before the server process has
> > finished...
> > ...Is there some way that I can "signal" the server to stop
> > processing so that I can go to the "location.href" page; or is there
> > some other way?

>
> You cannot directly cancel the request. The best you can do is have the

ASP
> process constantly monitor some independent entity (a session variable or

a
> record in a DB, for example), continuing only if some prearranged

condition
> is met. The cancel request would still be independent of the original
> request, but this should be possible in principle.
>
>
> --
> Dave Anderson
>
> Unsolicited commercial email will be read at a cost of $500 per message.

Use
> of this email address implies consent to these terms. Please do not

contact
> me directly or ask me to contact you directly for assistance. If your
> question is worth asking, it's worth posting.
>
>
>
>



 
Reply With Quote
 
Aaron Bertrand - MVP
Guest
Posts: n/a
 
      08-11-2003
Use a hidden frame.
http://www.aspfaq.com/2001
http://www.aspfaq.com/2281


"Larry Woods" <> wrote in message
news:...
> Thanks, Dave.
>
> What would be the best way to set a Session variable for the browser? A
> popup window ( 0 x 0 )?
>
> TIA,
>
> Larry
>
> "Dave Anderson" <> wrote in message
> news:...
> > "Larry Woods" wrote:
> > >
> > > I have a server page that has served an HTML page with a "Cancel"
> > > button on it, BUT this server page has not completed and is running
> > > a 15-30 second process before it completes. I want the browser user
> > > to be able to terminate the page before the server process has
> > > finished...
> > > ...Is there some way that I can "signal" the server to stop
> > > processing so that I can go to the "location.href" page; or is there
> > > some other way?

> >
> > You cannot directly cancel the request. The best you can do is have the

> ASP
> > process constantly monitor some independent entity (a session variable

or
> a
> > record in a DB, for example), continuing only if some prearranged

> condition
> > is met. The cancel request would still be independent of the original
> > request, but this should be possible in principle.
> >
> >
> > --
> > Dave Anderson
> >
> > Unsolicited commercial email will be read at a cost of $500 per message.

> Use
> > of this email address implies consent to these terms. Please do not

> contact
> > me directly or ask me to contact you directly for assistance. If your
> > question is worth asking, it's worth posting.
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Michael D. Kersey
Guest
Posts: n/a
 
      08-11-2003
Larry Woods wrote:
>
> I have a server page that has served an HTML page with a "Cancel" button on
> it, BUT this server page has not completed and is running a 15-30 second
> process before it completes.


Long-running processes are not good for web servers. You should write
this application a different way. See
http://www.google.com/groups?hl=en&l...40TK2MSFTNGP09
for a better way.

> I want the browser user to be able to
> terminate the page before the server process has finished.


Educate the user about the browser's "Stop" button. Alternatively the
user can click on another URL, select a bookmark, or enter a new URL.
When the Stop button is pressed, the TCP connection is reset and the
connection closed between client browser and server. Any queued output
will be discarded by whichever party (client, server or proxy agent) is
holding it.

Good Luck,
Michael D. Kersey
 
Reply With Quote
 
Larry Woods
Guest
Posts: n/a
 
      08-11-2003
The application is searching the Web using a second server; i.e., the ASP
server XMLHTTPs to a second server which is performing the searches.
USUALLY the second server responds in a fairly short time, but once in a
while it will be quite a while. It is possible that the user will want to
"bail out". Within the ASP server, I can abort the XMLHTTP session with the
second server if I know that I am to do it. We have implemented some
safeguards such as having the second server time out, and also having the
ASP server monitor the situation but there is STILL the possibility that the
user wants to terminate the "Please Wait" page.

Larry

"Dave Anderson" <> wrote in message
news:%...
> "Larry Woods" wrote:
> >
> > What would be the best way to set a Session variable for the
> > browser? A popup window ( 0 x 0 )?

>
> I should clarify my comments. Although I outlined a possible solution, it

is
> not one I recommend. You would be best served by designing processes that

do
> not need to be interrupted, as this other technique could be far more
> demanding on resources than you anticipate.
>
> What are you trying to accomplish, and why do you need to stop a process
> once it is underway?
>
>
> --
> Dave Anderson
>
> Unsolicited commercial email will be read at a cost of $500 per message.

Use
> of this email address implies consent to these terms. Please do not

contact
> me directly or ask me to contact you directly for assistance. If your
> question is worth asking, it's worth posting.
>
>



 
Reply With Quote
 
Larry Woods
Guest
Posts: n/a
 
      08-11-2003
That is a good idea, Aaron, but this solution is "IE only" and even though I
wish that I could depend on that this site is a public site so I can't
assume IE. Any other suggestions?

TIA,

Larry

"Aaron Bertrand - MVP" <> wrote in message
news:...
> Use a hidden frame.
> http://www.aspfaq.com/2001
> http://www.aspfaq.com/2281
>
>
> "Larry Woods" <> wrote in message
> news:...
> > Thanks, Dave.
> >
> > What would be the best way to set a Session variable for the browser? A
> > popup window ( 0 x 0 )?
> >
> > TIA,
> >
> > Larry
> >
> > "Dave Anderson" <> wrote in message
> > news:...
> > > "Larry Woods" wrote:
> > > >
> > > > I have a server page that has served an HTML page with a "Cancel"
> > > > button on it, BUT this server page has not completed and is running
> > > > a 15-30 second process before it completes. I want the browser user
> > > > to be able to terminate the page before the server process has
> > > > finished...
> > > > ...Is there some way that I can "signal" the server to stop
> > > > processing so that I can go to the "location.href" page; or is there
> > > > some other way?
> > >
> > > You cannot directly cancel the request. The best you can do is have

the
> > ASP
> > > process constantly monitor some independent entity (a session variable

> or
> > a
> > > record in a DB, for example), continuing only if some prearranged

> > condition
> > > is met. The cancel request would still be independent of the original
> > > request, but this should be possible in principle.
> > >
> > >
> > > --
> > > Dave Anderson
> > >
> > > Unsolicited commercial email will be read at a cost of $500 per

message.
> > Use
> > > of this email address implies consent to these terms. Please do not

> > contact
> > > me directly or ask me to contact you directly for assistance. If your
> > > question is worth asking, it's worth posting.
> > >
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Larry Woods
Guest
Posts: n/a
 
      08-11-2003
I'll look into the Google suggestion.

I want the user to terminate the page, but not the present session. In
another response to my question I have explained my application. The delay
is a possible looooong Web search by the server.

TIA,

Larry

"Michael D. Kersey" <> wrote in message
news:...
> Larry Woods wrote:
> >
> > I have a server page that has served an HTML page with a "Cancel" button

on
> > it, BUT this server page has not completed and is running a 15-30 second
> > process before it completes.

>
> Long-running processes are not good for web servers. You should write
> this application a different way. See
>

http://www.google.com/groups?hl=en&l...40TK2MSFTNGP09
> for a better way.
>
> > I want the browser user to be able to
> > terminate the page before the server process has finished.

>
> Educate the user about the browser's "Stop" button. Alternatively the
> user can click on another URL, select a bookmark, or enter a new URL.
> When the Stop button is pressed, the TCP connection is reset and the
> connection closed between client browser and server. Any queued output
> will be discarded by whichever party (client, server or proxy agent) is
> holding it.
>
> Good Luck,
> Michael D. Kersey



 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      08-11-2003
Well, you can use xmlhttp to run a second server-side page that sets a
session cancel variable to true can't you?

Bob

Larry Woods wrote:
> The application is searching the Web using a second server; i.e., the
> ASP server XMLHTTPs to a second server which is performing the
> searches. USUALLY the second server responds in a fairly short time,
> but once in a while it will be quite a while. It is possible that
> the user will want to "bail out". Within the ASP server, I can abort
> the XMLHTTP session with the second server if I know that I am to do
> it. We have implemented some safeguards such as having the second
> server time out, and also having the ASP server monitor the situation
> but there is STILL the possibility that the user wants to terminate
> the "Please Wait" page.
>
> Larry
>
> "Dave Anderson" <> wrote in message
> news:%...
>> "Larry Woods" wrote:
>>>
>>> What would be the best way to set a Session variable for the
>>> browser? A popup window ( 0 x 0 )?

>>
>> I should clarify my comments. Although I outlined a possible
>> solution, it is not one I recommend. You would be best served by
>> designing processes that do not need to be interrupted, as this
>> other technique could be far more demanding on resources than you
>> anticipate.
>>
>> What are you trying to accomplish, and why do you need to stop a
>> process once it is underway?
>>
>>
>> --
>> Dave Anderson
>>
>> Unsolicited commercial email will be read at a cost of $500 per
>> message. Use of this email address implies consent to these terms.
>> Please do not contact me directly or ask me to contact you directly
>> for assistance. If your question is worth asking, it's worth posting.



 
Reply With Quote
 
Aaron Bertrand - MVP
Guest
Posts: n/a
 
      08-11-2003
> That is a good idea, Aaron, but this solution is "IE only"

What? You can't use a hidden frame like this, in other browsers:

<frameset rows="99%, 1%">
<frame ...
<frame ...
</frameset>

???


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Killing threads (was Re: Cancel or timeout a long running regularexpression) Chris Angelico Python 2 09-21-2011 09:25 AM
Re: Cancel or timeout a long running regular expression Terry Reedy Python 4 09-18-2011 01:50 PM
Can I change the response URL to http://server/page.XLS instead of http://server/page.ASPX ? guillermojco@gmail.com ASP .Net 3 04-26-2007 04:49 AM
If server process is running, return last page state w/ msg AND w/o allowing page code to run (db activity) ack95 ASP .Net 0 03-03-2006 08:17 PM
HELP CANCEL CANCEL CANCEL Carmen Rosario Computer Support 7 04-06-2005 11:04 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57