Is there a way to check if the controller calling the method is called from the controller that is inside the scope?
For example, I have a class that inherits from AuthorizeAttribute, for example.
public class CustomAuthorize: System.Web.Mvc.AuthorizeAttribute
{
public CustomAuthorize()
{
...
}
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
}
}
Then I have some controller actions that are decorated with the corresponding Roles (as well as several other custom attributes), for example.
[CustomAuthorize(Roles ="Administrator")]
[HttpGet]
public virtual ActionResult Index()
{
...
}
In the TODO section above, I would like to find out if the controller is one of the controllers in one of my areas. I know that my controllers in the area will be in the ProjectName.Areas.xxx.Controllers namespace (where xxx is the Area name), while those that are not will be in the ProjectName.Controllers namespace.
- (, ?), AuthorizeCore , ( , ), ?