title: ASP.NET WebApi - Two Controllers With Similar Action Methods
body: <p>I have a scenario where I have 2 different controllers that each have multiple Get methods.  I have the methods decorated with the <code>ActionName</code> attribute, but the Routing isn't working as I think it should.</p>
  <p><strong>ContactController</strong></p>
  <pre><code>public ContactModel GetContactByID(string id)
  {
      ...
  }
  
  [ActionName(&quot;username&quot;)]
  public ContactModel GetContactByUserName(string text)
  {
      ...
  }
  </code></pre>
  <p><strong>PaymentController</strong></p>
  <pre><code>public PaymentModel Get(Guid id)
  {
      ...
  }
  
  [HttpGet, ActionName(&quot;sale&quot;)]
  public PaymentActivityModel Sale(Guid id)
  {
      ...
  }
  </code></pre>
  <p><strong>Routes</strong></p>
  <pre><code>config.Routes.MapHttpRoute(
      &quot;PaymentControllerActionId&quot;, 
      &quot;api/client/{clientId}/{controller}/{action}/{id}&quot;, 
      defaults: null 
  );
  
  config.Routes.MapHttpRoute(
      &quot;ContactControllerActionText&quot;, 
      &quot;api/client/{clientId}/{controller}/{action}/{text}&quot;, 
      defaults: null
  );
  
  config.Routes.MapHttpRoute(
      &quot;ClientControllerId&quot;, 
      &quot;api/client/{clientId}/{controller}/{id}&quot;, 
      new { id = RouteParameter.Optional }
  );
  </code></pre>
  <p>When I navigate to a Payment, it works fine.  But when I navigate to a Contact, I receive:</p>
  <blockquote>
  <p>No HTTP resource was found that matches the request URI, .../api/client/.../contact/username/exampleUserName</p>
  <p>No action was found on the controller 'Contact' that matches the request.</p>
  </blockquote>
  <p>I was under the impression that the parameter name would be matched up with the action name (<code>text</code> vs. <code>id</code>).</p>
  <p>Is the problem that one uses a <code>Guid</code> id and one uses a <code>string</code> id?</p>
  <p>This is a client-facing API, and I have a client-friendly ContactID that is a string.  Whereas the PaymentID is a Guid.</p>