When using the configuration.AddRoutesFromAssembly method it does not seem RoutePrefix or RouteArea attributes are observed. See below sample code/test:
[RouteArea("Fakes")]
[RoutePrefix("FakeItems")]
public class FakeItemsController : Controller {
[GET("Index")]
public ActionResult Index() {
return null;
}
}
[TestClass]
public class AttributeRoutingTests {
[TestMethod]
public void MapAttributeRoutes_SpecifyAssemblyInConfiguration_RoutePrefixInUrl() {
// Arrange
var routes = new RouteCollection();
// Act
routes.MapAttributeRoutes(config => {
config.AddRoutesFromAssembly(typeof(FakeItemsController).Assembly);
});
// Assert
Console.WriteLine(String.Format("{0} routes registered.",
routes.Count()));
foreach (var route in routes.Cast<Route>()) {
Console.WriteLine(route.Url);
}
Assert.IsTrue(routes.Any(r => ((Route)r).Url == "Fakes/FakeItems/Index"));
}
}
When using the configuration.AddRoutesFromAssembly method it does not seem RoutePrefix or RouteArea attributes are observed. See below sample code/test: