The authorize filter allows you to specified group of users that can access a controller or action:
[Authorize(Roles="Administrator")]
public class HomeController : Controller
{
// code
}
I would like to know if it is possible to, instead, specify a group of users that cannot access a controller or action.
I tried creating my own AuthorizationAttribute after twk’s suggestion:
And I use it like this:
I’m unsure whether it is correct practice but it does the job.