title: HttpClient PostAsync List<string> instead of file.csv
body: <p>I am attempting to post content to a vendor. The data uploads when I save my data to a .csv then reference the file. What I would prefer to do is skip saving the file to disk and just upload the data. I can't seem to figure out how to serialize the data correctly.</p>
  
  <p>Here is the data:</p>
  
  <pre><code>csv.Add(string.Join(",", "sara1234", "Ancient World Studies-1201A1-01"));
  csv.Add(string.Join(",", "jazzy4567", "Ancient World Studies-1201A1-01"));
  </code></pre>
  
  <p>Here is the upload:</p>
  
  <pre><code>protected async Task&lt;bool&gt; RunAsync(string baseAddress, IEnumerable&lt;string&gt; file, string passkey)
  {
      byte[] csvBytes = File.ReadAllBytes("C:\\Projects\\AutomationServiceFiles\\DataMig_Test\\Drop\\Hapara\\HaparaStudent.csv");
      var csvContent = new ByteArrayContent(csvBytes);
  
      using (var client = new HttpClient())
      {
          using (var content = new MultipartFormDataContent())
          {
              content.Add(new StringContent(passkey), "passkey");
              content.Add(csvContent, "uploadFile", "student.csv");
  
              var response = await client.PostAsync(baseAddress, content);
              response.EnsureSuccessStatusCode();
              string returnedContent = await response.Content.ReadAsStringAsync();
          }                
      }
      return true;
  }
  </code></pre>
  
  <p>I have tried what's shown below (instead of the file from disk). I get a 200 success message back, but data does not load. Specifically, the first method returns a message that the students were not found (this is good because I know the data was evaluated), the second returns no message at all.</p>
  
  <pre><code>string jsonFile = JsonConvert.SerializeObject(file);
  HttpContent contentPost = new StringContent(jsonFile, Encoding.UTF8, "application/json");
  content.Add(contentPost, "uploadFile", "student.csv");
  </code></pre>
  
  <p>Any suggestions?</p>