Sys.Net.XmlHttpExecutor abort Method
Stops the pending network call issued by the executor.
After a Web request is stopped, the pending time-out timer is canceled.
When abort is called, the executor sets the aborted property to true. This means that the get_started and get_aborted methods of the XmlHttpExecutor instance both return true.
The WebRequestManager instance then calls the completed event handler of the associated request object. After the abort method is called, the state of the response returned by the executor's methods is undefined.
You can call the abort method multiple times. However, the second and subsequent calls are not processed. The completed event handler is raised only one time.
If you call the abort method before you call the executeRequest method, an exception is thrown.
The following example shows how to stop a Web request using the abort method. This code is part of a complete example found in the Sys.Net.XmlHttpExecutor class overview.
// This function aborts a Web request.
// Create the WebRequest object.
wRequest = new Sys.Net.WebRequest();
// Set the request Url.
// Clear the results area.
resultElementId.innerHTML = "";
// Set the Completed event handler,
// for processing return data
// Make the request.
// Get the current executor.
var executor = wRequest.get_executor();
// Abort the request.
// Check if the executor is aborted.
var execAborted =
alert("Executor aborted: " + execAborted);