title: Download file with Xamarin
body: <p>I'm trying to download file with Xamarin, but receive an error massage:</p>
  
  <blockquote>
    <p>An exception occurred during a WebClient request. I thing that the problem is with unhautorization, but I try to download imagen for multiple web, and have the same problem.</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>public void getFile() {
  
      var pathToNewFolder = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/CodeScanner";
      Directory.CreateDirectory(pathToNewFolder);
  
      try
      {                
          WebClient webClient = new WebClient();
          webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);               
          var folder = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/CodeScanner";
          webClient.DownloadFileAsync(new Uri("http://www.dada-data.net/uploads/image/hausmann_abcd.jpg"), folder);
      }
      catch (Exception ex)
      {
          Console.WriteLine("ERROR:"+ ex.Message);
      }            
  }
  
  
  private void Completed(object sender, AsyncCompletedEventArgs e)
  {
      Console.WriteLine("ERROR: "+ e.Error.Message);
  } 
  </code></pre>
  
  <p>The error massage appears in <code>Console.WriteLine(</code> of <code>Completed</code> method. 
  Firts I create a folder and try to save file into it. </p>
  
  <p>When this work, only need downloat file from local server.</p>
  
  <p>thanks. </p>