title: MVC Attribute Routing Not Working
body: <p>I'm relatively new to the MVC framework but I do have a functioning Web Project with an API controller that utilizes AttributeRouting (NuGet package) - however, I'm starting another project and it just does not want to follow the routes I put in place.</p>
  
  <p>Controller:</p>
  
  <pre><code>public class BlazrController : ApiController
  {
      private readonly BlazrDBContext dbContext = null;
      private readonly IAuthProvider authProvider = null;
  
      public const String HEADER_APIKEY = "apikey";
      public const String HEADER_USERNAME = "username";
  
      private Boolean CheckSession()
      {
          IEnumerable&lt;String&gt; tmp = null;
          List&lt;String&gt; apiKey = null;
          List&lt;String&gt; userName = null;
  
          if (!Request.Headers.TryGetValues(HEADER_APIKEY, out tmp)) return false;
          apiKey = tmp.ToList();
  
          if (!Request.Headers.TryGetValues(HEADER_USERNAME, out tmp)) return false;
          userName = tmp.ToList();
  
          for (int i = 0; i &lt; Math.Min(apiKey.Count(), userName.Count()); i++)
              if (!authProvider.IsValidKey(userName[i], apiKey[i])) return false;
  
          return true;
      }
  
      public BlazrController(BlazrDBContext db, IAuthProvider auth)
      {
          dbContext = db;
          authProvider = auth;
      }
  
      [GET("/api/q/users")]
      public IEnumerable&lt;string&gt; Get()
      {
  
          return new string[] { "value1", "value2" };
      }
  
      [GET("api/q/usersauth")]
      public string GetAuth()
      {
          if (!CheckSession()) return "You are not authorized";
  
          return "You are authorized";
      }
  }
  </code></pre>
  
  <p>AttributeRoutingConfig.cs</p>
  
  <pre><code>public static class AttributeRoutingConfig
  {
      public static void RegisterRoutes(RouteCollection routes) 
      {    
          // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
          // To debug routes locally using the built in ASP.NET development server, go to /routes.axd
  
          routes.MapAttributeRoutes();
      }
  
      public static void Start() 
      {
          RegisterRoutes(RouteTable.Routes);
      }
  }
  </code></pre>
  
  <p>Global.asax.cs:</p>
  
  <p>// Note: For instructions on enabling IIS6 or IIS7 classic mode, 
      // visit <a href="http://go.microsoft.com/?LinkId=9394801">http://go.microsoft.com/?LinkId=9394801</a></p>
  
  <pre><code>public class WebApiApplication : System.Web.HttpApplication
  {
      protected void Application_Start()
      {
          AreaRegistration.RegisterAllAreas();
  
          WebApiConfig.Register(GlobalConfiguration.Configuration);
          FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
          RouteConfig.RegisterRoutes(RouteTable.Routes);
          BundleConfig.RegisterBundles(BundleTable.Bundles);
      }
  }
  </code></pre>
  
  <p>When I try to navigate to /api/q/users - I get a 404 not found error. If I change the routes to be "/api/blazr/users" - I get an error about multiple actions and not being able to determine which action to take.</p>
  
  <p>Any help is appreciated - I really just need a small nudge to figure out where the issue is, no need to solve it completely for me (I need to learn!)</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>routes.axd:</p>
  
  <pre><code>api/{controller}/{id}
  {resource}.axd/{*pathInfo}          
  {controller}/{action}/{id}
  </code></pre>