|
|
Microsoft's .NETI've been going around, telling people about .NET being ultimately an OS neutral programming framework into which you plug in any language that you feel like porting. That way, Microsoft can leap out of relying purely on Windows and into Linux if the 'nix revolution ever generates cash for desktop apps. See Mono::
System.DirectoryServicesThere have been various failures to even get this Assembly properly referenced in the ASP.NET project - it is not referenced by default even though it is a standard Assembly that comes with the .NET framework. Mark
Nicholson kindly spent some time researching and came up with the following
line:
<%@Assembly Name="System.DirectoryServices,
Version=1.0.3300.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"%> You can put this at the top of your .aspx page or into your global.asax. This Assembly as far as I can see, is a wrapper over ADSI. With ADSI, I could authenticate to this Netscape LDAP Server. However, searching for an entry was difficult or impossible because ADSI has no LDAPSearch function. Anyway, this time, I'm not interested in an ADSI interface, I want to do a System.DirectoryServices call. In particular, authenticated binding. My current code goes thus: Dim strServerDNS As String = "serverdnsname" Dim strUserDN As String = "CN=Joe Bloggs, O=org, C=AU" Dim strPassword As String = "xxx" Dim strLDAPPath As String = "LDAP://" & strServerDNS & "/" & strUserDN Dim objDirEntry As New System.DirectoryServices.DirectoryEntry(strLDAPPath) With objDirEntry .Username = strUserDN .Password = strPassword .AuthenticationType = DirectoryServices.AuthenticationTypes.ServerBind End With Try Me.txtResult.Text = objDirEntry.Properties(Me.txtProperty.Text).Value Catch Err as Exception Me.txtResult.Text = "Get Property Failed: " & Err.Message End TryNotes:
i |