title: Correct way of downloading a file with POST data using WebClient
body: <p>I currently have an app that posts data to a web server, then downloads the response. I use <code>UploadDataAsync</code> to achieve the result, using the following:</p>
  
  <pre><code>        using (var client = new WebClient())
          {
              var dataToPost = Encoding.Default.GetBytes(postBody);
  
              client.Headers.Add(HttpRequestHeader.Authorization, authToken); // Add the authorization header
  
              client.UploadDataCompleted += UploadCompleteCallback; // What do do when the download completes
              client.UploadProgressChanged += UploadProgressCallback; // What to do when the download is in progress
  
              client.UploadDataAsync(uri, "POST", dataToPost);
  
              while (client.IsBusy)
              {
                  // We're going to wait until the operation completes
              }
          }
  </code></pre>
  
  <p>It does successfully download the file, however I'm wondering if it's the correct way, because I'm not using <code>DownloadDataAsync</code>.</p>
  
  <p>The reason I'm not is because I can't find a way to send my POST data with the <code>DownloadDataAsync</code> method.</p>
  
  <p>Additionally, the <code>UploadProgressCallback</code> only gets called once when the app starts, then waits a while, and get's called again basically when the file is finished (So not a fluid download progress indicator). Is this possibly because I've used the <code>upload</code> instead of <code>download</code> ?</p>
  
  <p><strong>For completness</strong> here is my <code>UploadProgressCallback</code>:</p>
  
  <pre><code>    private static void UploadProgressCallback(object sender, UploadProgressChangedEventArgs e)
      {
          // Displays the operation identifier, and the transfer progress.
          Console.WriteLine("{0} Downloaded {1} of {2} bytes. {3} % complete...",
              (string)e.UserState,
              e.BytesReceived,
              e.TotalBytesToReceive,
              e.ProgressPercentage);
      }
  </code></pre>