Check Windows Principal : WindowsPrincipal « Authentication Authorization « ASP.NET Tutorial






<%@Page language="C#" %>
<%@Import Namespace="System.Security.Principal" %>
<script runat="server">
protected void Page_Load(object o, EventArgs e) {
  WindowsPrincipal principal = (WindowsPrincipal)HttpContext.Current.User;
  if(principal.IsInRole(WindowsBuiltInRole.Administrator)) {
    message.Text = "secret message for Administrators only";
  }
}
</script>
<form runat="server">
<asp:Label runat="server" id="message" Text="the text everyone can see" /><br> 
</form>








21.17.WindowsPrincipal
21.17.1.Check Windows Principal