Sys.Net.WebRequest add_completed Method
Registers a handler for the completed request event of the Web request.
MyWebRequest.add_completed(handler);
Arguments
Term |
Definition |
---|---|
handler |
The function registered to handle the completed request event. |
Remarks
The executor associated with the Web request raises the completed request event by calling the completed method. The handler function is called to process returned data when the work being performed by the associated executor is finished. Note that completion does not signify success. An executor finishes its work in one of three states: completed, aborted, or timed out.
The registered event handler function must accept two parameters:
A reference to the executor that issued the network request. You can access the executor to check its status and to retrieve the response data.
An eventArgs parameter that is set by the executor that raised the completed request event. For default executors, this argument is set to Sys.EventArgs.empty Property.
The event handler can determine the state of the executor by using one of the following executor properties: responseAvailable, aborted, or timedOut.
The event handler can access other response information about the executor only if responseAvailable returns true.
Example
The following example shows how to add and remove the completed event handler. This code is part of a complete example found in the WebRequest class overview.
See Also
Reference
Sys.Net.WebRequestManager Class