title: How to read body data in a post method in c#?
body: <p>This is my method:</p>
  
  <pre><code>        [HttpPost]
          public HttpResponseMessage LoginMethod()
          {
              HttpRequestMessage re = Request;
              var payLoadJson = re.Content;
  
              string jsonContent = payLoadJson.ReadAsStringAsync().Result;            
              var test = JObject.Parse(jsonContent);
              string userid = JObject.Parse(jsonContent)["MyFirstValue"].ToString();
              var password = JObject.Parse(jsonContent)["MySecondValue"].ToString();
            //Rest of operation
          }
  </code></pre>
  
  <p>I am passing two parameters here and want to fetch them.
  In <code>jsonContent</code> I am getting data like this:</p>
  
  <pre><code>         ------WebKitFormBoundarybBb6ip2FLSEzMmDq
   Content-Disposition: form-data; name="MyFirstValue"
  
   ABC
   ------WebKitFormBoundarybBb6ip2FLSEzMmDq
   Content-Disposition: form-data; name="MySecondValue"
  
   XYZ
   ------WebKitFormBoundarybBb6ip4iLSEzMmDq-- 
  </code></pre>
  
  <p>And getting error on the line where I am parsing <code>jsonContent</code> to <code>JObject</code> as Input string is not in correct format.
  I also tried <code>HttpContext.Current.Request["MyFirstValue"].ToString())</code> but I am getting <code>null</code> value there.</p>
  
  <p>Please suggest me where I am doing wrong. Thank You.</p>