Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (User.IsInRole("rolename")) {
- // what you wan't to do.
- }
- GenericIdentity userIdentity = new GenericIdentity((FormsIdentity)HttpContext.Current.User.Identity.Name);
- string[] roles = { "rolename1", "rolename2", "rolename3" };
- GenericPrincipal userPrincipal = new GenericPrincipal(userIdentity, roles);
- Context.User = userPrincipal;
- if (User.IsInRole("rolename1")) {
- // what you wan't to do.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement