Skip to content

08 Limit Controller Access to Certain Roles

M. Fares edited this page Mar 12, 2018 · 1 revision

Q. How I can limit the access to my controller to certain roles?

Decorate your controller or actions with the annotations

Users with Admin role can access this controller/action

[Authorize(Roles="Admin")]

User with Admin OR Manager roles can access this controller/action

[Authorize(Roles="Admin, Manager")] 

Users with Admin AND Manager roles can access this controller/action

[Authorize(Roles="Admin"]
[Authorize(Roles="Manager"] 

Clone this wiki locally