How to format LDAP driectory entry

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following line of code, but i don't think i am providing the right
syntax:


Dim oAllEntries As New DirectoryEntry(LDAP & LDAP_DOMAIN_SERVER &
LDAP_USERS, LDAP_DOMAIN & sUserName, sPassword)

Where
Public Const LDAP As String = "LDAP:"
I need to know how to format the remaining strings..
i.e

Public Const LDAP_DOMAIN_SERVER As String
Public Const LDAP_USERS As String =
Public Const LDAP_DOMAIN As String

Any ideas.. Thanks
 
Dim oAllEntries As New
DirectoryServices.DirectoryEntry("LDAP://SERVERNAME/OU=Divisions,dc=MyCompanyName,dc=ca", "DomainName\MyUserID", "MyPassword")
 
ok, one more specific question, my code is passing what is typed into the
username and password box as susername and sPassword

With that in mind, would this be an acceptable syntax

Dim oAllEntries As New
DirectoryEntry("Ldap://mgt-websrvr-01/OU=Staff,OU=People,DC=mgt,DC=gt,DC=buzz", "mgt\" & sUsername, sPassword)

Where I differ from your example is, i did not put the variables sUsername
and sPassword in quotes

I keep getting a server is not operational error, and i think it may be due
to my syntax..., maybe for testing purposes i'll just put in my id and
password like your example , just to make sure it is working
 
Also, server name does NOT have to be the domain controller, but the actual
name of the webserver where the code resides?
 
Also, server name does NOT have to be the domain controller, but the actual
name of the webserver where the code resides?

Actually, that should be "LDAP://domain.name/OU..." while you can specify a
server, specifying the domain name itself is more appropriate, since the
main domain controller might be down, and you might need to authenticate
against a secondary controller.
 
Thanks Erik...so defintely everything has to be in quotes ?

because i am wondering if my problem lies in the passing of the username and
password that is typed in to a textbox
 
Thanks Erik...so defintely everything has to be in quotes ?

because i am wondering if my problem lies in the passing of the username and
password that is typed in to a textbox

I'm not sure I understand. You only quote string literals.
 
Currently in another domain environment, this format below works:

Function Logon(ByVal sUserName As String, ByVal sPassword As String) As String

Dim sRetVal As String = ""

Dim oAllEntries As New DirectoryEntry(LDAP & LDAP_DOMAIN_SERVER &
LDAP_USERS, LDAP_DOMAIN & sUserName, sPassword)

where
Public Const LDAP As String = "LDAP:"
Public Const LDAP_DOMAIN_SERVER As String = "//test.ot.buzz/"
Public Const LDAP_USERS As String = "OU=Staff,OU=People,DC=test,DC=ot,DC=buzz"
Public Const LDAP_DOMAIN As String = "TEST.OT.BUZZ\"

In trying to translate this, it looks to me that the following line is being
buil
LDAP://test.ot.buzz/ou=staff,ou=people,dc=test,dc=ot,dc=buzz,test.ot.buzz\susername,spassword

and I am assuming that susername is coming in as jjohnson(example username)
and spassword is coming in as jjpassword

or is it coming in as "jjohnson" and the password as "jjpassword"

I am confused as to how the function is passing in the sUsername and
sPassword values.....

P.s, if you can't tell, i am new to this. I am taking some source code that
was already developed and trying to make it work in a new domain
 
Final solution that seemed to work:

Ok, the quick rundown



Fixed the ldap references In the code

Replaced the username and passwords for accounts in our domain (Remember
this code came from a separate company)

Installed Oracle Client software on Server

Installed Oracle OLE DB connectivity software (ODAC) from Oracle’s website.
This seemed to resolve the error I got in regards to the Oracle Client not
being found

Finally, the account used to access the database did not have the right to
view specific tables. It could see the list of tables, but not specific
tables.

My DBA had to create synonyms for the account used to access the database to
mimic the account that had ownership of the tables in the database.





At this point, I can now connect, perform queries on the tables, etc ,etc..



Wallah, thanks for the journey,

Thanks for all of your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top