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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:26:38+00:00 2026-06-14T23:26:38+00:00

I use asynchronous XMLHttpRequest to call a function in ASP.net web service. When I

  • 0

I use asynchronous XMLHttpRequest to call a function in ASP.net web service.
When I call an abort method on the XMLHttpRequest, after the server has received the request and processing it, the server continues processing the request.
Is there a way to stop the request processing on the server?

  • 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-14T23:26:40+00:00Added an answer on June 14, 2026 at 11:26 pm

    Generally speaking, no, you can’t stop the request being processed by the server once it has started. After all, how would the server know when a request has been aborted?

    It’s like if you navigated to a web page but browsed to another one before the first one had loaded. That initial request will, at least to some extent (any client-side work will of course not take place), be fulfilled.

    If you do wish to stop a long-running operation on the server, the service that is being invoked will need to be architected such that it can support being interrupted. Some psuedo code:

    void MyLongRunningMethod(opId, args)
    {
        work = GetWork(args)
    
        foreach(workItem in work)
        {
            DoWork(workItem)
    
            //Has this invocation been aborted?
            if(LookUpSet.Contains(opId))
            {
                LookUpSet.Remove(opId)
                return
            }
            //Or try this:
            if(Response.IsClientConnected)
            {
                HttpContext.Current.Response.End();
                return;
            }
        }
    }
    
    void AbortOperation(opId)
    {
        LookUpSet[opId] = true
    }
    

    So the idea here is that MyLongRunningMethod periodically checks to see if it has been aborted, returning if so. It is intended that opId is unique, so you could generate it based on the session Id of the client appended with the current time or something (in Javascript, new Date().getTime() will get you the number of milliseconds since the epoch).

    With this sort of approach, the server must maintain state (the LookUpSet in my example), so you will need some way of doing that, such as a database or just storing it in memory. The service will also need to be architected such that calling abort does not leave things in a non-working state, which of course depends very heavily on what it does.

    The other really important requirement is that the data can be split up and worked on in chunks. This is what allows the service to be interruptable.

    Finally, if some operation is to be aborted, then AbortOperation must be called – simply aborting the XMLHttpRequest invocation won’t do help as the operation will continue until completion.

    Edit

    From this question: ASP.Net: How to stop page execution when browser disconnects?

    You could also check the Response.IsClientConnected property to try and determine whether the invocation had been aborted.

    Generally speaking, the server isn’t going to know that a client has disconnected until it attempts to send data to it. See Best practice to detect a client disconnection in .NET? and Instantly detect client disconnection from server socket.

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

Sidebar

Related Questions

In an ASP.NET MVC3 application, I'm trying to use jQuery to make an asynchronous
I have 2 different XMLHttpRequest objects making asynchronous requests to the same web service.
I have read that I can use asynchronous call with polling especially when the
I use unit test. Also I use asynchronous requests for retrive data from server.
I want to use an asynchronous method to select strings from SQLite DB with
I'm switching over our site to use Asynchronous Google Analytics, and I'm curious about
The Wikipedia page for WS-Addressing states: WS-Addressing supports the use of asynchronous interactions by
Is it possible to use a service asynchronously in the grails bootstrap class? I
I am calling a library method that is synchronous. I'd like to use the
Does jQuery.ajax({async: false}) still use the XMLHttpRequest object? If so, how is the request

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.