CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Location
    Sydney, Australia
    Posts
    40

    Is there an IsInGroup Function

    I would like to check if a user on an ASP.net web form is in a particular group.

    I have Forms authentication turned on and need to check programitacilly if a user is in a group or not to allow access to various fnctions.

    There is a User.IsInRole function but I always get false for just the Group Name or Domain/Group Name.

    Is a Role different to a Group?

    Any samples around like this?

    Also, is there a way to identify all the groups in a domain via WMI or something?

    Thank you

    David

  2. #2
    Join Date
    Apr 1999
    Location
    Sydney, Australia
    Posts
    40

    RE: IsInRole

    User.IsInRole exists in web forms and can be used as

    User.IsInRole("Domain\Group")

    However, if the Group is predefined by Windows then you need to use
    BUILTIN\Group

    I have seen code that actually checks security like

    Dim wp As New System.Security.Principal.WindowsPrincipal(CType(User.Identity, System.Security.Principal.WindowsIdentity))
    wp.IsInRole("Domain\Group")

    But I do not know why the difference.

    I still can not find out how to get the list of groups on a network.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured