WebClient.CancelAsync Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Cancels a pending asynchronous operation.

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

public void CancelAsync()

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

When you call CancelAsync, your application still receives the completion event associated with the operation. For example, when you call CancelAsync to cancel a DownloadStringAsync operation, if 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 on the base class of DownloadDataCompletedEventArgs in the event data object passed to the event handler.

If no asynchronous operation is in progress, this method does nothing.

.NET Framework
Available since 2.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: