title: Why are my Area specific Web API’s accessible from all other Areas?
body: <p>I am currently working on a ASP.NET MVC 4 Web Application project that must adhere to the following design decisions:</p>
  <ul>
  <li>The main MVC application resides in the root of the solution.</li>
  <li>All administrator functionality resides in a separate area.</li>
  <li>Each external party (e.g. suppliers) has its own area.</li>
  <li>Each area, including the root, constitutes a well separated
  functional block. Functionality from one area may not be exposed to
  another area. This is to prevent unauthorized access of data.</li>
  <li>Each area, including the root, has its own RESTfull API (Web API).</li>
  </ul>
  <p>All normal controllers in all areas, including the root, work as expected. However, some of my Web API controllers exhibit unexpected behaviour. For instance, having two Web API controllers with the same name but in different areas produces the following exception:</p>
  <blockquote>
  <p>Multiple types were found that match the controller named ‘clients’.
  This can happen if the route that services this request
  (‘api/{controller}/{id}’) found multiple controllers defined with the
  same name but differing namespaces, which is not supported.</p>
  <p>The request for ‘clients’ has found the following matching controllers:
  MvcApplication.Areas.Administration.Controllers.Api.ClientsController
  MvcApplication.Controllers.Api.ClientsController</p>
  </blockquote>
  <p>This seems strange since I have distinct routes that should separate both. Here is my AreaRegistration for the Administration section:</p>
  <pre><code>public class AdministrationAreaRegistration : AreaRegistration
  {
      public override string AreaName
      {
          get
          {
              return &quot;Administration&quot;;
          }
      }
  
      public override void RegisterArea(AreaRegistrationContext context)
      {
          context.Routes.MapHttpRoute(
              name: &quot;Administration_DefaultApi&quot;,
              routeTemplate: &quot;Administration/api/{controller}/{id}&quot;,
              defaults: new { id = RouteParameter.Optional }
          );
  
          context.MapRoute(
              &quot;Administration_default&quot;,
              &quot;Administration/{controller}/{action}/{id}&quot;,
              new { action = &quot;Index&quot;, id = UrlParameter.Optional }
          );
      }
  }
  </code></pre>
  <p>Moreover, I notice that I can access Area specific Web API’s while omitting the name of the area from the call.</p>
  <p>What is going on here?
  How do I get my Web API Controllers to behave just like normal ASP.NET MVC controllers?</p>