Re: Network Path not found

From: Willy Denoyette [MVP] (willy.denoyette@pandora.be)
Date: 09/06/02


From: "Willy Denoyette [MVP]" <willy.denoyette@pandora.be>
Date: Fri, 6 Sep 2002 12:37:26 +0200


Don't use DirectoryServices/ADSI for this, use Windows Authentication and WebServer.User.IsInrole to check group membership.

Willy.

"Albert Waelti" <albert.waelti@gmx.net> wrote in message news:12fe401c2557a$ac5296e0$39ef2ecf@TKMSFTNGXA08...
> Hi,
>
> I'd like to test if a user belongs to the
> group "MyGroupName" and I used the
> following code, but I always get the error "Network Path
> not found.". What's
> wrong ?
> I'm using ASP.NET.
>
> ============================================
> Dim oDirNTRoot As DirectoryEntry = New
> DirectoryEntry("WinNT://MyDomain/computer", sUsername,
> sPassword)
>
> Dim oUserDir As DirectoryEntry = oDirNTRoot.Children.Find
> (sUsername, "user")
> Dim oGroupDir As DirectoryEntry = oDirNTRoot.Children.Find
> ("MyGroupName",
> "group")
>
> Dim bIsGroupMember As Boolean = False
> If oGroupDir.Name <> "" Then
> bIsGroupMember = oGroupDir.Invoke("IsMember", New
> Object()
> {oUserDir.Path.ToString()})
> End If
>
> ============================================
>
> Are there other ways to do this using LDAP ?
>
> Thanks in advance
>
> Albert
>
>



Relevant Pages

  • Re: Get SAMAccountNames for all users in an active directory group
    ... what is the point of the impersonation code? ... Dim arrListSAMAccounts As New ArrayList ... Dim searchRoot As DirectoryEntry = Nothing ...
    (microsoft.public.windows.server.active_directory)
  • System.Byte[] And System.__ComObject in AD LDAP Browser
    ... If you use the DirectoryEntry, it marshals the value as an ADSI ... dim pwdDate as DateTime ... Imports System.DirectoryServices ... Private Sub LDAPBrowser_Load(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.languages.vb)
  • System.Byte[] And System.__ComObject in Active Directory LDAP brow
    ... If you use the DirectoryEntry, it marshals the value as an ADSI ... dim pwdDate as DateTime ... Imports System.DirectoryServices ... Private Sub LDAPBrowser_Load(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.general)
  • Re: ADODB to ADO.NET conversion
    ... DirectoryEntry item = result.GetDirectoryEntry; ... Dim entry As New ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet)
  • .net code to create AD user account
    ... Dim objADAM As DirectoryEntry ' Binding object. ... Dim strDisplayName As String ' Display name of user. ... Dim strUser As String ' User to create. ...
    (microsoft.public.dotnet.languages.vb)