title: MVC Routing picking up Area controllers at root
body: <p>I'm having difficulties with my controllers that are in an Area answering requests on routes that aren't for the area. So I have a setup like this (Extra stuff cut):</p>
  
  <pre><code>/Areas/Security/Controllers/MembersController.cs
  /Areas/Security/SecurityAreaRegistration.cs
  /Controllers/HomeController.cs
  </code></pre>
  
  <p>I have my area for security defined:</p>
  
  <pre><code>namespace MyApp.Web.Areas.Security
  {
      public class SecurityAreaRegistration : AreaRegistration
      {
          public override string AreaName
          {
              get
              {
                  return "Security";
              }
          }
  
          public override void RegisterArea(AreaRegistrationContext context)
          {
              context.MapRoute(
                  "Security_default",
                  "Security/{controller}/{action}/{id}",
                  new { action = "Index", id = UrlParameter.Optional }
              );
          }
      }
  }
  </code></pre>
  
  <p>And my global routing rules:</p>
  
  <pre><code>        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
          routes.IgnoreRoute("{*robotstxt}", new { robotstxt = @"(.*/)?robots.txt(/.*)?" });
          routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
  
          routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}/{id}",
              defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
              namespaces: new string[] { "MyApp.Web.Controllers" }
          );
  </code></pre>
  
  <p>In my global asax I'm doing quite a few things but the relevant part is that I call <code>AreaRegistration.RegisterAllAreas();</code> then I call the routing function that does the above.</p>
  
  <p>But my problem is that requests for "/Members/" are hitting my Members controller using my "Default" route... even though the controller's not in the namespace I specified. Then when it tries to run it can't find it's Views cause they're defined in the Area and it's trying to find them in the overall Views folders. I tried making the route namespace <code>"Weird.Namespace.With.No.Content"</code> and it STILL hits the Members controller - I can't find any way to make it not use that controller. How do I make it not answer requests that aren't in it's area?</p>