WebClient.CancelAsync Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Cancels a pending asynchronous operation.

Namespace: System.Net
Assembly: System.Net (in System.Net.dll)


Public Sub CancelAsync
public void CancelAsync()


Exception Condition

There is not enough memory to continue the execution of the program.


The execution stack overflowed because it contains too many nested method calls.


A call was made to the Thread..::.Abort method to destroy a thread.


If an operation is pending, this method calls Abort on the underlying WebRequest.

When you call the CancelAsync method, your application still receives the completion event associated with the operation. For example, if you call CancelAsync to cancel a DownloadStringAsync operation and you have specified an event handler for the DownloadStringCompleted event, your event handler receives notification that the operation has ended. To learn whether the operation completed successfully, check the Cancelled property of the AsyncCompletedEventArgs for the relevant completed event handler.

If you cancel a string download operation and you check the Result property of the

DownloadStringCompletedEventArgs object, an exception will occur.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0


Windows Phone

See Also


WebClient Class

System.Net Namespace