Re: Parsing Domain Groups with .NET

From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 08/27/03

  • Next message: Joe Kaplan \(MVP - ADSI\): "Re: Securing Dll Assmebly For Specified EXE Client"
    Date: Tue, 26 Aug 2003 22:16:39 -0500
    
    

    If you are using Windows authentication in IIS and ASP.NET and the web
    server is a domain member, then you get this for free from the .NET security
    infrastructure.

    Context.User.IsInRole("mydomain\my group") will return true or false based
    on the current logged on user. You can also use Page.User.

    The IPrincipal interface doesn't provide you with a means to enumerate the
    domain groups though. For that, you need to do LDAP lookups with he
    DirectoryEntry class or use P/Invoke to pull the TOKEN_GROUPS structure from
    the user's token (available from the WindowsIdentity class which is the
    IIdentity member of the IPrincipal) and resolve the SIDs into names via
    P/Invoke or LDAP lookups.

    HTH,

    Joe K.

    "Aaron Ghadiyali" <aghadiyali@atlantaregional.com> wrote in message
    news:009501c36bfb$7c143bd0$a501280a@phx.gbl...
    > Hello,
    > I need to be able to get the Domain Groups that a domain
    > authenicated user is in when they login/navigate through
    > an ASP.NET application. For example, if Aaron is in the
    > groups DOMAIN Admins and SQL DBA's, I want to be able to
    > get that info (Domain Admins and SQL DBA's) on the groups
    > they are in with .NET somehow. Does anyone know of an
    > object I can use or tap into this/Active Directory like
    > that?
    >


  • Next message: Joe Kaplan \(MVP - ADSI\): "Re: Securing Dll Assmebly For Specified EXE Client"

    Relevant Pages

    • Re: Windows Authentication from Web App in DMZ
      ... >a domain member) using windows authentication. ... best would be to use SQL Authentication... ... IIS and SQL Server on Separate Machines with Trusted ...
      (microsoft.public.inetserver.iis.security)
    • Re: Q: Named pipes and Windows (integrated) authentication
      ... >By the way, if you don't have SQL Enterprise Manager, there's an MSDE ... >>>his windows authentication to connect to the server. ... >>>Creating databases is only acomplished after you've already connected. ...
      (microsoft.public.sqlserver.connect)
    • Re: Problem connecting to an SQL 2005 Express Instance in RANU mod
      ... This is working fine when the user is a domain member. ... May be this is an issue with SQL 2005 Express Edition SP2 running on VISTA ... Hitchhiker's Guide to Visual Studio and SQL Server ... I'm using SQL2005 Express User Instance Feature. ...
      (microsoft.public.sqlserver.connect)
    • RE: MELL and SQL
      ... At this point I'm logged in as admin and since ... have the necessary permissions for the installation. ... > Most third party apps don't use Windows Authentication, they use SQL ...
      (microsoft.public.windows.server.sbs)
    • Re: SQL Server Authentication
      ... I'm sorry to hear you are having some troubles with SQL authentication. ... can I would love to persuade you to use Windows authentication if at all ... > With VSTO using Visual Studio 2005, has anyone manage to use SQL Server ...
      (microsoft.public.vsnet.vstools.office)