title: Sending url params and POST body to a MVC 2 Controller
body: <p>I'm having some issues trying to make a HTTP PUT (or POST) using WebClient against a MVC 2 controller. The exception is:</p>
  
  <pre><code>The parameters dictionary contains a null entry for parameter 'total'
  of non-nullable type 'System.Int32' for method
  'System.Web.Mvc.ActionResult Company(System.Guid, Int32, Int32, System.String)'
  </code></pre>
  
  <p>The controller action is:</p>
  
  <pre><code>[HttpPut]
  public ActionResult Company(Guid uid, int id, int total, string url)
  </code></pre>
  
  <p>The route is:</p>
  
  <pre><code>routes.MapRoute(
      "CompanySet",
      "job/active/{uid}/company/{id}",
      new { controller = "Job", action = "Company" }
  );
  </code></pre>
  
  <p>The client code is:</p>
  
  <pre><code>var putData = Encoding.ASCII.GetBytes("total=919&amp;amp;url=test");
  var client = new WebClient();
  client.UploadData("http://localhost/job/active/1/company/2", "PUT", putData);
  </code></pre>
  
  <p>As you may see, what I want is to send the '<b>uid</b>' and '<b>id</b>' parameters <b>via url</b>, <em>and</em> the '<b>total</b>' and '<strong>url</strong>' parameters as part of the <strong>PUT</strong> or <strong>POST</strong> <strong>body</strong>.</p>
  
  <p>I've also tried to merge the latter parameters into a class (i.e., CompanySetMessage), doing it no longer raises an exception but I dont receive the values on the server side.</p>
  
  <p>Any ideas? Thank you!</p>