What happens to a response if the browser is shut down?

B

Bruce W.1

A user posts a request that takes a long time to process, say two
minutes, before a response is returned.

What happens if in this two minutes the user closes their browser. Does
the server have any way of knowing this? Is anything sent to the server
to tell it that the browser is closing, so that the reponse processing
might be terminated?

If not then what happens when the server returns a response to a browser
that no longer exists. What type of Exception in thrown?

Thanks for your help.
 
B

Bruce W.1

Steve C. Orr said:
You can check every so often to make sure Response.IsClientConnected.
If the user bails out for some reason (like closing their browser or
clicking the Stop button) then this will return false and you can quit your
processing.

Here's more info:
http://msdn.microsoft.com/library/d...ebhttpresponseclassisclientconnectedtopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
==============================================================

Cool! That should be handy.

I'm trying to implement a counter which counts how many instances of a
web page got a response. So I've got an Application["Count"] = "0";

When the counter hits zero I will change some value. I will decrement
the counter with each succesful response. However I need a failsafe way
to ensure that everybody got a response and there are no outstanding
responses, before I change some value. To do this I need to trap any
error caused by a response that was sent to a disconnected client. In
the catch block will be code to decrement the counter.

What kind of error Exception is returned from a failed response?

Thanks.
 
H

Hans Kesting

Bruce W.1 said:
A user posts a request that takes a long time to process, say two
minutes, before a response is returned.

What happens if in this two minutes the user closes their browser. Does
the server have any way of knowing this? Is anything sent to the server
to tell it that the browser is closing, so that the reponse processing
might be terminated?

If not then what happens when the server returns a response to a browser
that no longer exists. What type of Exception in thrown?

Thanks for your help.

I don't think any exception is thrown: the asp.net subsystem successfully
completes
it's processing and transfers the results to IIS. IIS doesn't get a reply,
so drops this
response.

As another poster has said, you could use Response.IsClientConnected, but I
am not
sure how accurate that is. I don't think this will return "false" the
instant the
user closes his browser. In any case, when you get "true", you can be sure
you don't
need to send a response.

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top