What happens to Cancelled HTTP Requests

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What happens to a cancelled http request from the server perspective?

Here's the scenario.

I request a page from the web server and page requires lot of processing.
Before the response comes to the browser I either hit the Stop button on the
browser or moved on to another page.

Now at the server, does it continue to process the request? or does ASP.Net
terminate the processing because the TCP connection of the HTTP requests is
longer active?

Whats the story here?

Thanks a lot.

Chandra
 
ASP.NET doesn't know that the user hit the stop button, or if they
closed the browser - it will continue to toil away at the request in
hopes it can bring happiness to the user.

If you have a really processing intensive section of code you can call
Response.IsClientConnected in code and skip all the hard work if the
property returns false. I would not litter the code by placing these
checks everywhere though, because it would be the exceptional case
that a client has disconnected, and also because I have some doubts as
to the accuracy of the property.

HTH,
 
Response.IsClientConnected will not detect the stop until data is sent to
the client (as http over tcp/ip does not do heartbeats). you would have to
turn page buffering off, and flush responses doing the processing to detect
earlier.

-- bruce (sqlwork.com)
 
Back
Top