Is current user member of group


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. bool isMember = false;
  2. SPWeb oWeb = SPContext.Current.Web;
  3. isMember = web.IsCurrentUserMemberOfGroup(web.Groups["Your Group"].ID);
  4.  
  5. // Check If user belong to your group.
  6. if (isMember==false)
  7. {
  8. //Redirect to AccessdDenied.aspx
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.