title: post multipart/form-data in c# HttpClient 4.5
body: <h1>Problem</h1>
  
  <p>I am trying to post API to send data to API which calls my internal API service to send that data to other API i service. Entity contains property with files . this send only file to the other derive but the <strong>NameSender</strong> property not send with the file.</p>
  
  <h1>Entity</h1>
  
  <pre><code>public class Email
  {
  
      public string NameSender{ get; set; }
  
      public List&lt;IFormFile&gt; Files { get; set; }
  
  
  }
  </code></pre>
  
  <h1>Api</h1>
  
  <pre><code>[Consumes("multipart/form-data")]
  [HttpPost]
  public IActionResult SendEmail([FromForm]Entity entity)
  {
      try
      {
          string Servicesfuri = this.serviceContext.CodePackageActivationContext.ApplicationName + "/" + this.configSettings.SendNotificationServiceName;
  
          string proxyUrl = $"http://localhost:{this.configSettings.ReverseProxyPort}/{Servicesfuri.Replace("fabric:/", "")}/api/values/Send";
  
          //attachments
          var requestContent = new MultipartFormDataContent();
  
  
          foreach (var item in entity.Files)
          {
              StreamContent streamContent = new StreamContent(item.OpenReadStream());
              var fileContent = new ByteArrayContent(streamContent.ReadAsByteArrayAsync().Result);
              requestContent.Add(fileContent, item.Name, item.FileName);
  
          }
  
          HttpResponseMessage response = this.httpClient.PostAsync(proxyUrl, requestContent).Result;
  
  
          if (response.StatusCode != System.Net.HttpStatusCode.OK)
          {
              return this.StatusCode((int)response.StatusCode);
          }
  
          return this.Ok(response.Content.ReadAsStringAsync().Result);
      }
      catch (Exception e)
      {
          throw e;
      }
  }
  </code></pre>