title: Web API QueryString not passing second parameter to controller/action
body: <p>I have a Web API application which is expected to return a list of clinical alerts for patients. The request is invoked with the following URL </p>
  
  <pre><code>http://myserver:18030/api/Alerts/search?systemId=182&amp;patientId=T000282L
  </code></pre>
  
  <p>where the systemId determines the clinical information system for which the patientID value is relevant. The routing is set up as follows in WebApiConfig.cs</p>
  
  <pre><code>public static void Register(HttpConfiguration config)
      {
          config.Routes.MapHttpRoute(
             name: "Alertsapi",
             routeTemplate: "api/Alerts/search",
             defaults: new { controller = "Alerts" , action = "search"}
         );
  </code></pre>
  
  <p>and the controller actions is as follows:</p>
  
  <pre><code>    [ActionName("search")]
      public  List&lt;Alert&gt; GetAlerts(string systemId = "", string patientId = "")
      {
          var alerts = from a in db.Alerts
                      where a.alertAuthorReference.Equals(systemId)
                      where a.alertSubjectReference.Equals(patientId)
                      select a;
          return alerts.ToList();
      }
  </code></pre>
  
  <p>I was under the impression that QueryString parameters where automatically mapped to action method parameters, but in this example patientId is always null (or an empty string as I am supplying that as a default). I have tried reading the QueryString in code inside the action method, but it only has one member with key systemId.</p>
  
  <p>Why isn't the second parameter being passed through?</p>
  
  <p>I can work around it by using a QueryString of patientId=182:T000282L and then parsing this composite key, but I want to be able eventually to search on multiple parameters, and so may need to access a third or even fourth value from the query string.</p>