asp.net - How set Authorization attribute role MVC4 to the user? -
i'm trying use authorize attribute on mvc 4 application,
[authorize(roles = "administrator, super-user")] public jsonresult remove(int id) { . . . } i know roles "administrator" , "super-user" roles authorized execute method remove, how can set role actual user of application?
you can add current user role using
roles.adduserstorole(new string[]{httpcontext.current.user.identity.name}, "admin");
roles class available in system.web.security namespace.
if want add users , roles -open solution in visual studio goto project->asp.net configuration->security tab
Comments
Post a Comment