Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Help with IsInRole

    Hi,
    I am using windows integrated authentication aon my intranet. How do I check
    if a user is a member of a group in active directory. I have the foll test
    code but it's not working



    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button1.Click

    If User.IsInRole("USA\Administrators") Then

    TextBox2.Text = ("Role: Administrator").ToString

    Else

    TextBox2.Text = ("Unable to check Role").ToString




    End If
    End Sub

    note: usa is name of my domain


    I get the second message "Unable to check Role". The Windows Authentication
    works great. If i use


    TextBox1.Text = User.Identity.Name

    I get the correct logged on user. The only problem here is checking the
    role/group in active directory.

    Thanks
    Chris Guest

  2. Similar Questions and Discussions

    1. IsInRole Performance Issue
      Hi, We have a very large AD here and I am noticing that the WindowsPrinciple IsInRole function is taking upwards of 1 second to respond with just a...
    2. WindowsPrincipal.IsInRole() is Being Flaky. Help!!
      Its just being inconsistent. I'm in 3 different Groups in AD. ..IsInRole("Groupx") returns true ..IsInRole("Groupy") returns true...
    3. isInrole
      I am using isInRole function to check if a user is in a group. It works ok except it will suddenly stop working and I will have to reboot to get it...
    4. Problems with IsInRole
      I'm having problems with WindowsPrincipal.IsInRole. It's returning false when it should return true. I've written some test code that uses...
    5. User.IsInRole not redirecting
      Hi there, I have been reading up on Authorization and role based security for a couple of days now, and am trying to implement this in my...
  3. #2

    Default Re: Help with IsInRole

    Administrators is one of the special BUILTIN Group. It is like a
    localized kind of special domain. On your web server it is most likely
    added to the users session token when authenticated against IIS because
    the user is a member of your USA\Domain Admins group which has been
    added to your Web Servers BUILTIN\Administrators group. If that is the
    case then use:

    User.IsInRole("BUILTIN\Administrators")

    In C#
    User.IsInRole(@"BUILTIN\Administrators")


    Or you can use User.IsInRole("USA\Domain Admins").

    But there is no USA\Administrators group available at the web server.







    Joseph E Shook [MVP - ADSI] Guest

  4. #3

    Default Re: Help with IsInRole

    Thank you sir!

    "Joseph E Shook [MVP - ADSI]" wrote:
    > Administrators is one of the special BUILTIN Group. It is like a
    > localized kind of special domain. On your web server it is most likely
    > added to the users session token when authenticated against IIS because
    > the user is a member of your USA\Domain Admins group which has been
    > added to your Web Servers BUILTIN\Administrators group. If that is the
    > case then use:
    >
    > User.IsInRole("BUILTIN\Administrators")
    >
    > In C#
    > User.IsInRole(@"BUILTIN\Administrators")
    >
    >
    > Or you can use User.IsInRole("USA\Domain Admins").
    >
    > But there is no USA\Administrators group available at the web server.
    >
    >
    >
    >
    >
    >
    >
    >
    Chris Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139