title: How I can pass Json from Win Forms to MVC Controller
body: <p>I have MVC Controller given below:</p>
  
  <pre><code>public ActionResult ReceiveJson(string json)
  {
      //--
  
      return Content(json, "application/json");
  
  }
  </code></pre>
  
  <p>I created Windows Forms Application. In the application I want to pass Json to my MVC Controller.</p>
  
  <p>I use:</p>
  
  <pre><code>string json = new JavaScriptSerializer().Serialize(myObject);
  
      using (var client = new CookieAwareWebClient())
      {
          var values = new NameValueCollection
              {
                  { "username", login },
                  { "password", haslo },
              };
  
          client.UploadValues("http://localhost/xxxxx/Login", values);
  
          string link = "http://localhost/xxx/ReceiveJson";
  
          client.Headers.Add("Content-Type", "application/json");
          var response = client.UploadString(new Uri (link), "POST", json);
      }
  </code></pre>
  
  <p>This code doesn't work. In  ReceiveJson Controller I received null.</p>
  
  <p><a href="http://s22.postimg.org/9vxu2no9t/json.jpg" rel="nofollow">http://s22.postimg.org/9vxu2no9t/json.jpg</a></p>
  
  <p>Can you tell me how I can pass Json from Win Forms to MVC Controller?</p>
  
  <p>Thanks ;-)</p>