By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,652 Members | 1,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,652 IT Pros & Developers. It's quick & easy.

LDAP-Authentification

P: n/a
Hi there,

I try to make an authorisation bind to the LDAP with ASP.NET. I use the
DirectoryServices Namespace and the MSDN documented way to do it, but every
time I get an "COMException: Server is not operational". Can anyone tell me
what I have to do to avoid this???

Thanks,

Nico
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
First, make sure you have the proper LDAP path. for instance, lets say
your domain is called mycompany.local then your LDAP would be:

LDAP://DC=mycompany,DC=local

then when creating your DirectoryEntry, make sure you have the right
LDAP path, domain and username, and password like so:

DirectoryEntry entry = new
DirectoryEntry("LDAP://DC=mycompany,DC=local","mycompany.local\username", "domainPassword");

If it is complaining about the server, then your problem lays somewhere
in the first couple steps of your authentication.

hope that helps!

Nov 19 '05 #2

P: n/a
Hi,

thanks for that. But I still get the same Exception.

Nico

"DKode" <dk****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
First, make sure you have the proper LDAP path. for instance, lets say
your domain is called mycompany.local then your LDAP would be:

LDAP://DC=mycompany,DC=local

then when creating your DirectoryEntry, make sure you have the right
LDAP path, domain and username, and password like so:

DirectoryEntry entry = new
DirectoryEntry("LDAP://DC=mycompany,DC=local","mycompany.local\username", "domainPassword");

If it is complaining about the server, then your problem lays somewhere
in the first couple steps of your authentication.

hope that helps!

Nov 19 '05 #3

P: n/a
what is the exception you are getting, can you post your code and then
line that is causing the problem?

Nov 19 '05 #4

P: n/a
Hi,

code:

Try
'objDirEntry = New
DirectoryEntry("LDAP://ldap.myCompany.com:636/uid=" & uid &
",ou=People,o=hp.com", "uid=" & uid & ",ou=People,o=hp.com", passwd,
AuthenticationTypes.Secure)
objDirEntry = New
DirectoryEntry("LDAP://ldap.myCompany.com:636/uid=" & uid &
",ou=People,o=myCompany.com", uid, passwd, AuthenticationTypes.Secure)
Catch ex As System.Exception
ErrorLabel.Text = ex.Message
End Try

Dim errortext As String

' get the data from the form
Dim UName As String = username.Text
Dim UDomain As String = domain.Text
Dim UserLogin As String = UDomain & ":" & UName
Dim searcher As DirectorySearcher
' execute search
searcher = New DirectorySearcher(objDirEntry)

searcher.Filter = "(ntUserDomainId=" & UserLogin & ")"

ErrorLabel.Text = searcher.FindOne().Path // <-- this throws the
Exception

Try
Dim dirEntry As New DirectoryEntry(searcher.FindOne().Path,
objDirEntry.Username, objDirEntry.Password, objDirEntry.AuthenticationType)
ErrorLabel.Text =
objDirEntry.Exists(searcher.FindOne().Path).ToStri ng
Catch ex As System.Runtime.InteropServices.COMException
ErrorLabel.Text = ex.Message
'End Try
Exception:

System.Runtime.InteropServices.COMException: The server is not operational

Stack Trace:

COMException (0x8007203a): The server is not operational]
System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail) +514
System.DirectoryServices.DirectoryEntry.Bind() +10
System.DirectoryServices.DirectoryEntry.get_AdsObj ect() +10
System.DirectoryServices.DirectorySearcher.FindAll (Boolean
findMoreThanOne) +199
System.DirectoryServices.DirectorySearcher.FindOne () +31
I only get this Exception when I try to bind a user to the AD. There is no
exception if I read some data from the Directory (like username).
Thanks again

Nico

"DKode" <dk****@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
what is the exception you are getting, can you post your code and then
line that is causing the problem?

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.