title: Aborting a WebClient.DownloadFileAsync operation
body: <p>What is the best way to cancel a DownloadFileAsync operation safely?  </p>
  
  <p>I have a thread (background worker) that kicks off the download and manages other aspects of it and that I end when I see that the thread has <code>CancellationPending == true.</code>  After kicking off the download, the thread will sit and spin until the download has completed, or the thread is cancelled.  </p>
  
  <p>If the thread is cancelled, I want to cancel the download.  Is there a standard idiom for doing this?  I've tried <code>CancelAsync</code>, but I get a WebException from it (aborted).  I'm not sure this is a clean way of doing the cancel.</p>
  
  <p>Thanks.</p>
  
  <p>Edit: the first exception is and object disposed one on the internal stream (call stack):</p>
  
  <blockquote>
    <p>System.dll!System.Net.Sockets.NetworkStream.EndRead(System.IAsyncResult asyncResult)
    System.dll!System.Net.PooledStream.EndRead(System.IAsyncResult asyncResult)</p>
  </blockquote>