title: Use C# HttpWebRequest to send json data to web service
body: <p>I am trying to send http request of json data to a web service. It successfully get directed to the web service but the data is always null...</p>
  
  <p>Here is my web service:</p>
  
  <pre><code>public bool CheckUserExist ([FromBody] string Email)
      {
          List&lt;User&gt; all_users = repo.getUsers();
          var match = all_users.Find(i =&gt; i.Email == Email);
          if (match == null)
          {
              return false;
          }
          else
          {
              return true;
          }
      }
  </code></pre>
  
  <p>and here is my Http Request:</p>
  
  <pre><code>var webAddr = "http://localhost:59305/api/User/CheckUserExist";
  var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);
  httpWebRequest.ContentType = "application/json; charset=utf-8";
  httpWebRequest.Method = "POST";
  using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
                  {
                      string json = "{\"Email\":\"Email\"}";
                      streamWriter.Write(json);
                      streamWriter.Flush();
                  }
  var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
  using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                  {
                      var result = streamReader.ReadToEnd();
                      return RedirectToAction("Index");
                  }
  </code></pre>
  
  <p>as i mentioned...Iam using a debugger at the web service function...the request get directed to the service but variable "Email" is always null</p>