I'm trying to do full attribute routing, without conventional routing, and trying to tell my routes which area they belong to based on the current domain.
In convention routing, I can specify my object constraints with this as an example:
context.MapRoute(
"MyRouteName",
"admin/sign-in",
new { controller="AdminController", action="SignIn" },
new { SitePermitted = new SiteConstraint("Admin") } // <-- how do I do this exact line of code but in attribute routing
);
Where SiteConstraint inherits from IRouteConstraint. How do I do the same thing, but using attribute routing? I am looking for something like this:
[AreaName("Admin")]
[Route("admin/sign-in")]
[new SiteConstraint("Admin")]
public ActionResult SignIn(...) {...}
Where MyConstraint has a Match method that gets the current http request and if its domain is "myadmindomain.com", then Match method returns true, and MVC executes this route given that the user is on myadmindomain.com/admin/sign-in.