Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9258503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:25:19+00:00 2026-06-18T12:25:19+00:00

Does an HttpHandler listen for a disconnect from the browser? My guess is no

  • 0

Does an HttpHandler listen for a disconnect from the browser?

My guess is “no” since it seems to be mostly/only used for dynamic file creation, so why would it?

But I can’t find an answer in the docs or goog.

Many thanks in advance!

Background

I’d like to “abort” an HttpHandler because currently, I allow huge excel exports (~150k sql rows, so ~600k html lines). For reasons almost as ridiculous as the code, I have a query that fires for as many sql rows that the user tries to export. As you can imagine, this takes a very long time.

I think I’m getting backed up with worker processes because users probably get frustrated with the lag, and try again with a smaller result. I currently flush the worker procs automatically every 30 min, but I’d rather cleanup more quickly.

I don’t have the time to clean up the sql right now, so I’d like to just listen for an “abort” from the client and kill the handler if “aborted”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:25:20+00:00Added an answer on June 18, 2026 at 12:25 pm

    What you’re hoping to accomplish by listening for a client connection drop won’t really help solve your problem at all. The core of your problem is a long running task being kicked off in an HttpHandler directly.

    In this case, even if you could listen for a client disconnect it wouldn’t ever be acted upon as your code will be too busy executing to listen for it.

    The only way to properly determine progress and perform actions during long running processes such as this is to ensure that your code is multi-threaded. The problem with doing this in ASP.NET for long running processes is they’ll suck up threads from the thread pool needed to serve your pages. This could result in your website hanging or responding very slowly, as you’ve been experiencing.

    I would recommend writing a Windows Service to handle these long running jobs and having it spit the results into a staging directory. I would then use MSMQ or similar to throw the request to the service for processing.

    Ultimately, you want to get this long running thread outside of ASP.NET where you can take advantage of the benefits that multi-threading can offer you. Such as, the ability to report back the progress and to abort when needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HttpHandler that reads the parameters from the request URL by simply
I am trying to return HTML from a HttpHandler via jQuery. I am using
My httphandler does not work in IIS7 (virutal directory), but using cassini it works.
I am currently generating a sitemap file dynamically using a HttpHandler, with a path
I am sending a file to the user using a HttpHandler. On all browsers,
How can I make a HTTPHandler in an ashx file PLACE a SessionCookie managed
The following HttpHandler is to retrieve image from database. When I initially tested it
My .ashx Handler called from a jQuery AJAX post occasionally does not receive form
Question: How does one deploy a HttpHandler in asp.net 2.0? Updated Http Handler code
I have httpHandler that handles the jpg file. When a request for a jpg

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.