HighTechTalks DotNet Forums  

LDAP problem

Dotnet Security microsoft.public.dotnet.security


Discuss LDAP problem in the Dotnet Security forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Alessandro
 
Posts: n/a

Default LDAP problem - 06-14-2007 , 04:20 AM






Hi !
I'm trying to connect my web application (NET 2.0) to a Unix LDAP server.

if i try to search users everything go ok:


Dim directoryEntry As New
System.DirectoryServices.DirectoryEntry("LDAP://ip/path", "", "",
DirectoryServices.AuthenticationTypes.Anonymous)

directorySearcher1 = New
System.DirectoryServices.DirectorySearcher(directo ryEntry)
directorySearcher1.SearchScope = DirectoryServices.SearchScope.Subtree
directorySearcher1.Filter = "uid=name.surename"

Dim oSearchResult As System.DirectoryServices.SearchResult
Try
oSearchResult= directorySearcher1.FindOne()
oentry = searcResult.GetDirectoryEntry()

tot = searcResult.Properties.Count - 1
Dim myResultPropColl As
System.DirectoryServices.ResultPropertyCollection
myResultPropColl = searcResult.Properties
Dim myKey As String
For Each myKey In myResultPropColl.PropertyNames
Dim tab1 As String = " "
Response.Write(myKey + " = ")
Dim myCollection As Object
For Each myCollection In myResultPropColl(myKey)
Try
Response.Write(tab1 + myCollection.ToString + "<br>")
Catch ex As Exception
Response.Write(tab1 + " errore proprietà " + "<br>")
End Try
Catch ex As Exception

End Try


BUT i'm not able to authenticate an user with login and password....

i try with

Dim directoryEntry As New
System.DirectoryServices.DirectoryEntry("LDAP://ip/path", username,
uiserpassword, DirectoryServices.AuthenticationTypes.secure)


but it doesn't work !

ith an old DLL (LDAP2lib) i was able to do:

bindUser = oMyLDAP.BindUser(path, uid=name.surename, Password)

if bindUser was 1 the user login and password were ok, if 2 user ok password
wrong, if 3 user doesn't exists.....



Reply With Quote
  #2  
Old   
Joe Kaplan
 
Posts: n/a

Default Re: LDAP problem - 06-14-2007 , 10:30 PM






You multiposted. I answered on another newsgroup.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"Alessandro" <settler80 (AT) hotmail (DOT) com> wrote

Quote:
Hi !
I'm trying to connect my web application (NET 2.0) to a Unix LDAP server.

if i try to search users everything go ok:


Dim directoryEntry As New
System.DirectoryServices.DirectoryEntry("LDAP://ip/path", "", "",
DirectoryServices.AuthenticationTypes.Anonymous)

directorySearcher1 = New
System.DirectoryServices.DirectorySearcher(directo ryEntry)
directorySearcher1.SearchScope = DirectoryServices.SearchScope.Subtree
directorySearcher1.Filter = "uid=name.surename"

Dim oSearchResult As System.DirectoryServices.SearchResult
Try
oSearchResult= directorySearcher1.FindOne()
oentry = searcResult.GetDirectoryEntry()

tot = searcResult.Properties.Count - 1
Dim myResultPropColl As
System.DirectoryServices.ResultPropertyCollection
myResultPropColl = searcResult.Properties
Dim myKey As String
For Each myKey In myResultPropColl.PropertyNames
Dim tab1 As String = " "
Response.Write(myKey + " = ")
Dim myCollection As Object
For Each myCollection In myResultPropColl(myKey)
Try
Response.Write(tab1 + myCollection.ToString + "<br>")
Catch ex As Exception
Response.Write(tab1 + " errore proprietà " + "<br>")
End Try
Catch ex As Exception

End Try


BUT i'm not able to authenticate an user with login and password....

i try with

Dim directoryEntry As New
System.DirectoryServices.DirectoryEntry("LDAP://ip/path", username,
uiserpassword, DirectoryServices.AuthenticationTypes.secure)


but it doesn't work !

ith an old DLL (LDAP2lib) i was able to do:

bindUser = oMyLDAP.BindUser(path, uid=name.surename, Password)

if bindUser was 1 the user login and password were ok, if 2 user ok
password wrong, if 3 user doesn't exists.....




Reply With Quote
  #3  
Old   
Joe Kaplan
 
Posts: n/a

Default Re: LDAP problem - 06-14-2007 , 10:30 PM



You multiposted. I answered on another newsgroup.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"Alessandro" <settler80 (AT) hotmail (DOT) com> wrote

Quote:
Hi !
I'm trying to connect my web application (NET 2.0) to a Unix LDAP server.

if i try to search users everything go ok:


Dim directoryEntry As New
System.DirectoryServices.DirectoryEntry("LDAP://ip/path", "", "",
DirectoryServices.AuthenticationTypes.Anonymous)

directorySearcher1 = New
System.DirectoryServices.DirectorySearcher(directo ryEntry)
directorySearcher1.SearchScope = DirectoryServices.SearchScope.Subtree
directorySearcher1.Filter = "uid=name.surename"

Dim oSearchResult As System.DirectoryServices.SearchResult
Try
oSearchResult= directorySearcher1.FindOne()
oentry = searcResult.GetDirectoryEntry()

tot = searcResult.Properties.Count - 1
Dim myResultPropColl As
System.DirectoryServices.ResultPropertyCollection
myResultPropColl = searcResult.Properties
Dim myKey As String
For Each myKey In myResultPropColl.PropertyNames
Dim tab1 As String = " "
Response.Write(myKey + " = ")
Dim myCollection As Object
For Each myCollection In myResultPropColl(myKey)
Try
Response.Write(tab1 + myCollection.ToString + "<br>")
Catch ex As Exception
Response.Write(tab1 + " errore proprietà " + "<br>")
End Try
Catch ex As Exception

End Try


BUT i'm not able to authenticate an user with login and password....

i try with

Dim directoryEntry As New
System.DirectoryServices.DirectoryEntry("LDAP://ip/path", username,
uiserpassword, DirectoryServices.AuthenticationTypes.secure)


but it doesn't work !

ith an old DLL (LDAP2lib) i was able to do:

bindUser = oMyLDAP.BindUser(path, uid=name.surename, Password)

if bindUser was 1 the user login and password were ok, if 2 user ok
password wrong, if 3 user doesn't exists.....




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.