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 7415687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:21:01+00:00 2026-05-29T07:21:01+00:00

I have a long running ASP response (actually an MVC action) that I want

  • 0

I have a long running ASP response (actually an MVC action) that I want to cancel if the user has navigated away. I think this should be fairly simple:

if(!this.Response.IsClientConnected)
{
    Response.End();
}

However I’ve come across various sources starting that this method is slow.

So I ran my own tests (using MVC mini profiler, though you could use your own):

using (var step = MiniProfiler.Current.Step("Response_IsClientConnected"))
if(!this.Response.IsClientConnected)
{
    Response.End();
}

That found that every time I call it it’s consistently very fast: under 1ms on my developer set up. This is whether it’s true or false.

Under what circumstances is Response.IsClientConnected expected to be slow?

I have to support IIS6 – would Response.IsClientConnected be slower on that?

Does anyone know what it’s doing under the covers? At a low level I’d expect the TCP/IP stack to know whether the connection is still there, so I’d expect this check to be instant, but does IIS have to do some additional work to check?

  • 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-05-29T07:21:02+00:00Added an answer on May 29, 2026 at 7:21 am

    Good question but unfortunately don’t have the answer, but can provide the following information. Hopefully this can be a starting point to know what’s it’s doing under the covers.

    The Response.IsClientConnected is checking this by asking the current worker HttpWorkerRequest handling the request.

    The worker request can be one of the following types and is created by the ISAPIWorkerRequest.CreateWorkerRequest(IntPtr ecb, bool useOOP) which is called by the ISAPIRuntime.ProcessRequest(IntPtr ecb, int iWRType). This is the entry point from the low level ISAPI to the ASP.NET runtime.

    1. ISAPIWorkerRequestInProcForIIS6
    2. ISAPIWorkerRequestInProcForIIS7 >= IIS7
    3. ISAPIWorkerRequestInProc < IIS6
    4. ISAPIWorkerRequestOutOfProc For out of proc requests

    For all the InProc HttpWorkerRequest workers this call is then directed back to unmanaged code by calling int EcbIsClientConnected(IntPtr pECB) which is located in the webengine.dll pECB being the Extension Control Block (ECB), provides all the low level access to the ISAPI request. This reference is initially passed to the ISAPIRuntime.ProcessRequest.

    Now I can’t find any implementation details of the EcbIsClientConnected method. So without this it’s impossible to know what it’s doing under the covers and how this maybe differs for the different versions of IIS. Maybe someone else can explain this? I would like to know as well.

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

Sidebar

Related Questions

I have an ASP.NET site that has been running perfectly for a long time,
We have an ASP.NET application that queues some of its long-running operations (generating reports,
I have a long-running asynchronous task that is kicked off from an ASP.NET MVC4
We have a long running data transfer process that is just an asp.net page
I have a long running process that is called via a Nancy Module Get
I have a long running console app running through millions of iterations. I want
I have a long-running cleanup operation that I need to perform in onDestroy() of
I have an ASP.Net application running under IIS 6. A simple page has two
I have an existing set of singleton WCF services. They are long-running processes that
I have a Refresh button on my page that will perform an asp.net mvc

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.