Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple roles in Controller action [duplicate]

i try to create custom role provider in mvc4 to give user access in my site. when i try to using role provider is success.

i success create role provider like this

[Authorize(Roles = "admin")]

my question is, can i use more then one role name in controller? i mean like.

[Authorize(Roles = "admin")]
[Authorize(Roles = "admin")]

try to use this code, but not working for me. any one can show me how does it work? thanks

like image 842
novian kristianto Avatar asked Dec 16 '22 03:12

novian kristianto


1 Answers

Yes, like this:

[Authorize(Roles = "admin,userRole")]
like image 154
hutchonoid Avatar answered Dec 28 '22 14:12

hutchonoid