title: Convert CURL to C#
body: <p>I have spent ages trying various different ways to convert this curl to c#. Could someone please help.
  I am trying to do a http post and keep getting error 500.
  here is what I want to convert:</p>
  
  <pre><code>curl --user username:password -X POST -d "browser=Win7x64-C1|Chrome32|1024x768&amp;url=http://www.google.com" http://crossbrowsertesting.com/api/v3/livetests/
  </code></pre>
  
  <p>and this is what I have so far:</p>
  
  <pre><code>    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(baseurl);
  request.Method = "POST";
  request.Accept = "application/json";
  request.Credentials = new NetworkCredential(username, password);
  
  var response = request.GetResponse();
  string text;
  
  using (var sr = new StreamReader(response.GetResponseStream()))
  {
      text = sr.ReadToEnd();
      values.Add(text);
  }
  </code></pre>
  
  <p>Tried this method too but it didn't work:</p>
  
  <pre><code>List&lt;string&gt; data = new List&lt;string&gt;();
          data.Add("browser=Win7x64-C1|Chrome20|1024x768");
          data.Add("url=URL");
          data.Add("format=json");
          data.Add("callback=doit");
          var request = WebRequest.Create("CrossBrowserTestingURL");
          request.Method = "POST";
          request.ContentType = "application/x-www-form-urlencoded";
          request.Credentials = new NetworkCredential(username, password);
          using (var writer = new StreamWriter(request.GetRequestStream()))
          {
              writer.Write("data=" + data);
          }
  
          var response = request.GetResponse();
  
          string text;
  
          using (var sr = new StreamReader(response.GetResponseStream()))
          {
              text = sr.ReadToEnd();
              values.Add(text);
          }
  </code></pre>