DotNetNuke, ASP.NET, Web Development Blog

DotNetnuke: Is user an admin / administrator

DotNetNuke makes it easy to determine if the currently logged in user is an administrator (aka admin) or any other role for that matter. All you need to do is call the following: PortalSecurity.IsInRole("Administrators") or PortalSecurity.IsInRole("MyRoleName"). This function should return the boolean value very quickly as everything it needs is already in memory. You can call this from either the code behind or the ascx file (e.g. Visible='<%#PortalSecurity.IsInRole("Administrators")%>').

This can be very useful for determining whether or not to show a control or content meant only for the right groups eyes.

Comments

Gravatar
amir Says:
10/20/2011 6:39:03 AM
thank u so much
it was every useful
Leave a Comment
Gravatar
Name:
Email: (not displayed)
Comments:

CAPTCHA image
Enter the code shown above:
Website

Return to previous page
  Search Articles...