473,788 Members | 2,810 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
17 3278
> It is possible that the user will want to "bail out".

And such a user would use the STOP button, why are you trying to invent your
own methodology to replace it?
Jul 19 '05 #11
Larry Woods wrote:

I'll look into the Google suggestion.

I want the user to terminate the page, but not the present session. Clicking on the Stop button resets the HTTP connection; it does not
affect the current session.
In another response to my question I have explained my application. The delay
is a possible looooong Web search by the server.

Consider doing the XMLHTTP fetches in a background task or program and
not by an ASP page if they require more than a few seconds of
processing. Otherwise your own web server's memory and CPU will be tied
up waiting.

A periodic VBScript batch run or a VB program can do the XMLHTTP
searches and won't bog down your web server. Users' experiences will be
better since they are free to do other browsing while waiting for the
XMLHTTP searches to complete: users could check results hours or days
later. When your web server goes down, requests are not lost. When your
database server goes down, once it is restarted requests will be
requeued automatically (the user doesn't have to re-enter them). You
would get a more reliable, better-performing system.

You could also provide users with a mechanism for killing a search if
that search takes too long or if a user changes his/her mind and decides
the search results are not necessary. All that is possible with the
suggestion that I made on Google, but most is not available to you
otherwise.

Good Luck,
Michael D. Kersey
Jul 19 '05 #12
Sorry, guys! Just going by the statement by the author at the beginning of
the article on aspfaq. Didn't check any further. Figured he knew. Oooops!

Larry

"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:OU******** ******@tk2msftn gp13.phx.gbl...
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 #13
Larry Woods wrote:
Michael,
Could you clarify one of your statements:
"Otherwise your own web server's memory and CPU will be tied up waiting."
Are you saying that an ASP site does not multi-thread?

No. What I meant was that:
- each thread that loads an XMLHTTP component waits for completion of
that component's request,
- that wait apparently can take many seconds, or can timeout, or can
fail,
- during that wait time, the resources (memory, CPU) used by that thread
are tied up and are unavailable for processing other HTTP requests.

ASP (indeed, HTTP, but that is a bigger story) is designed so that
requests are received, processed quickly and responses returned. Waiting
for *any* I/O process (file access, database access, an XMLHTTP request
to another website) ties up resources (CPU and memory). However, while
file access and database access are typically performed in micro- or
milli-seconds, an HTTP request is measured in seconds or tens of
seconds. And the likelihood of timeout or failure is much, much higher
for an HTTP request to a remote server than for a database or file
access on a local server.

Summary: long-running ASP scripts can bog down a web server if many
requests arrive in a short time.

Good Luck,
Michael D. Kersey
Jul 19 '05 #14
The ASP page can see if the client is still active by
checking Response.IsClie ntConnected (I think it is a
memebr of Response, check the docs for more details) and
if the client is not connected then stop processing the
page.

Alternatively you could try something detaild here;

http://www.aspfree.com/articles/1333,1/articles.aspx

Which is bascially Micahel's suggesting with code.

ASP is mutli-threaded but you don't get too many threads,
and the reason is that pages are supposed to execute very
quickly. When you have long-running tasks then those
threads can quickly get used up.
-----Original Message-----
I have a server page that has served an HTML page with a "Cancel" button onit, BUT this server page has not completed and is running a 15-30 secondprocess before it completes. I want the browser user to be able toterminate the page before the server process has finished. What I tried wasan onClick event that issued a "location.href. .." in hopes that this wouldload this referenced page, etc. but I have found that the browser waitsuntil the server process had compled before executing the "location.href" .Is there some way that I can "signal" the server to stop processing so thatI can go to the "location.h ref" page; or is there some other way?
TIA,

Larry Woods
.

Jul 19 '05 #15
Great info, Adrian..and article, also.

What determines the number of threads that ASP gets?

Larry
"Adrian Forbes - MVP" <ad****@xxxnoem ailxxx.com> wrote in message
news:0d******** *************** *****@phx.gbl.. .
The ASP page can see if the client is still active by
checking Response.IsClie ntConnected (I think it is a
memebr of Response, check the docs for more details) and
if the client is not connected then stop processing the
page.

Alternatively you could try something detaild here;

http://www.aspfree.com/articles/1333,1/articles.aspx

Which is bascially Micahel's suggesting with code.

ASP is mutli-threaded but you don't get too many threads,
and the reason is that pages are supposed to execute very
quickly. When you have long-running tasks then those
threads can quickly get used up.
-----Original Message-----
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 #16
>What determines the number of threads that ASP gets?

IIS5 defaults to 25/processor and IIS4 10/processor but
you can change the defaults if you want.

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnserv/html/server02282000. asp

http://www.microsoft.com/serviceprov...tepapers/tunin
giis.asp

More worrying that IIS's thread pool is if your long-
running code is inside MTS/COM+ as that has even less
threads given to it.
Jul 19 '05 #17
Ignorance on my part...

I am instantiating a dll (visual basic-based) that is doing a bunch of
calculations. I have not defined it within a transaction, or anything like
that. It don't access any of the ASP objects, etc. The exposes some
properties and methods. The user "feeds" some data via properties; then
executes a method, which does the calculations, returning a value.

Question: Is this running under MTS/COM+ ??

TIA,

Larry Woods

"Adrian Forbes - MVP" <ad****@xxxnoem ailxxx.com> wrote in message
news:01******** *************** *****@phx.gbl.. .
What determines the number of threads that ASP gets?


IIS5 defaults to 25/processor and IIS4 10/processor but
you can change the defaults if you want.

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnserv/html/server02282000. asp

http://www.microsoft.com/serviceprov...tepapers/tunin
giis.asp

More worrying that IIS's thread pool is if your long-
running code is inside MTS/COM+ as that has even less
threads given to it.

Jul 19 '05 #18

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
2415
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
2320
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
1716
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
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
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
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
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.