title: Get and file content using web-api and consume it
body: <p>I'm trying to read PDF file, send its content (byte array wise) using httpget web api and then, in the client, create a new PDF file based on the get data from the web API.
  However - when transferring the Byte[] data - it is being corrupted, meaning the size of the data changes.
  this is my code:
  This is the web api get method:</p>
  
  <pre><code>[Route("api/SystemSigner/Files/GetFile")]
  public Byte[] GetFile()
  {
      var path = @"&lt;pdf path&gt;.pdf";
      var dataBytes = File.ReadAllBytes(path);
      return dataBytes;
  }
  </code></pre>
  
  <p>This is the web api "communicator" for consuming it (<strong>it returns a task with a different size</strong>):</p>
  
  <pre><code>public static async Task&lt;Byte[]&gt; GetFile()
  {
      Byte[] retrunedTask = null;
      using (var client = new HttpClient())
      {
          client.BaseAddress = new Uri(ConfigurationManager.AppSettings["WebApiUri"] + "/Files/GetFile");
          client.DefaultRequestHeaders.Accept.Clear();
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/pdf"));
          retrunedTask = await client.GetByteArrayAsync(client.BaseAddress);
      }
      return retrunedTask;
  }
  </code></pre>
  
  <p>This is the client consumer:</p>
  
  <pre><code>private async void CreateFile()
  {
      Byte[] fileByteArray = await WebApiCommunicator.GetFile();
      string filePath = @"&lt;File path to save the file&gt;";
      File.WriteAllBytes(filePath , fileByteArray);
  }
  </code></pre>