473,774 Members | 2,275 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I cancel a running server page from the browser?

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.h ref" page; or is there some other way?

TIA,

Larry Woods
Jul 19 '05 #1
17 3276
"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.h ref" 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.


Jul 19 '05 #2
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" <GT**********@s pammotel.com> wrote in message
news:Or******** ******@TK2MSFTN GP10.phx.gbl...
"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.h ref" 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.

Jul 19 '05 #3
Use a hidden frame.
http://www.aspfaq.com/2001
http://www.aspfaq.com/2281
"Larry Woods" <la***@lwoods.c om> wrote in message
news:OD******** ******@TK2MSFTN GP12.phx.gbl...
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" <GT**********@s pammotel.com> wrote in message
news:Or******** ******@TK2MSFTN GP10.phx.gbl...
"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.h ref" 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.


Jul 19 '05 #4
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
Jul 19 '05 #5
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" <GT**********@s pammotel.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
"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.

Jul 19 '05 #6
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" <aa***@TRASHasp faq.com> wrote in message
news:eE******** ******@TK2MSFTN GP10.phx.gbl...
Use a hidden frame.
http://www.aspfaq.com/2001
http://www.aspfaq.com/2281
"Larry Woods" <la***@lwoods.c om> wrote in message
news:OD******** ******@TK2MSFTN GP12.phx.gbl...
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" <GT**********@s pammotel.com> wrote in message
news:Or******** ******@TK2MSFTN GP10.phx.gbl...
"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.h ref" 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.



Jul 19 '05 #7
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" <md******@hal-pc.org> wrote in message
news:3F******** *******@hal-pc.org...
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

Jul 19 '05 #8
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" <GT**********@s pammotel.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
"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.

Jul 19 '05 #9
> 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>

???
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5877
by: Stephen | last post by:
I have code which checks whether a datagrid is empty and if it is it shows a panel on my page. If its not empty then Im using the server.transfer to go to another page so as im able to use the items in an array list. My problem is that I also have had to incorporate some Javascript to see whether the user is ok with moving forward. Everything is fine and works apart from when the user clicks cancel on the pop-up Internet Explorer window it...
3
2414
by: MB | last post by:
Hi, I am doing a project which uses asp.net to develop its forms. The form uses validation web controls to validate the data entered in text boxes. When Cancel Button is pressed which is to exit from the current page and go to the previous page, the validation controls activate because data has not been entered, and the user cannot cancel. I have used Response.Redirect(webpage) but the validations activates and unless I enter some data...
6
2093
by: Ken Varn | last post by:
I have an ASP.NET form that may take a very long time to process a particular request. If the user closes the browser window, the request will continue to process until it completes. This is a problem when a user tries to re-establish a new session. Since the previous request is still being processed, the new request must now wait for it to complete. Is there anyway to force old IIS processing thread sessions to terminate if they are...
13
2317
by: Mickey | last post by:
Hi all, Currently I use a timestamp to log users out after 15 minutes of inactivity. However I also need to log a user out if they have just left the page. I need to do this because I store current online users in a database, allowing a maximum of 5 users at one time. I have been looking through the php manual and came across session_cache_expire(). This isn't doing what I need either. Am I
5
2069
by: jeremy | last post by:
I have an ASP.Net 2.0 application running on Windows Server 2003. The application displays properly in Internet Explorer, however, when I use a browser control embedded in a .net form, I get an error and am directed to the Windows Application Event Log. The following message is logged: ------------- Source: ASP.NET 1.1.4322.0 Event ID: 1062
2
1715
by: tirath | last post by:
hi, I have a web site where user provide some search criteria and click on button "Search". I want to provide a "Cancel" button which user can click. In case search takes long, user clicks on Cancel and he remains on the same page without any result. basically i do not want web client to wait for result. he should get option to cancel. Please help me, this is urgent. Thanks
7
4672
by: John Gault | last post by:
I experimented with a snippet of JavaScript that will display a "Please Wait" message and graphic while the results of a cgi script is running (the script grabs a bunch of data and formats it in a table). Once the page has loaded, the script clears the message and graphic. It works fine, however if you click the button on the browser to cancel the page load, the browser will render what it can of the table and the "Please Wait" message...
5
3484
by: This | last post by:
I have a pretty basic emailing script that sends a relatively small number (150) of html emails. The emails are compiled, personalised from a mysql db subscribers list, and sent using mail() - after sending, a small summary html page is sent to the user with number sent, time taken and a simple navigation choice. Up to about 100 emails it all works fine - this takes the server about 27 secs . Any more than that and although the emails are...
1
2326
BeemerBiker
by: BeemerBiker | last post by:
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...
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.