Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

LDAP problems

Hi,

I wrote a small app to extract data from an LDAP server which worked fine on my own workstation. As soon as I tried to port it to the server, however, it failed when I tried to get the following fields:

sAMAccountName, givenName and department

with the following error:

"The active directory datatype cannot be converted to/from a native DS datatype"

Any clues?

Colm
Wednesday, February 02, 2005

Just a couple notes -

- It seems to be failing in exactly the same way wherever I port it. I've tried running it another developer's machine and three servers, all with identical configurations to my own. Same problem each time.

- I've found documentation that says that this problem is caused by the AD schema not being refreshed. But, I've put in code to refresh the schema and it doesn't change anything.

- The error does sometimes (rarely) occur on my machine (as opposed to ALL the time on everybody else's machine), but it goes away when I restart IIS.

Thanks for any help. This problem is really bugging me.

Colm
Thursday, February 03, 2005

Could you could post the code, please? Or at least a snippet?

Raj Chaudhuri
Friday, February 04, 2005

This is the part where it's failing:

Try
    Dim obj = GetObject(res.Path)
    Dim oSchema = GetObject("LDAP://swndc02/Schema")   
    oSchema.GetInfo() ' force refresh of schema
    obj.GetInfo()
    Return obj.Get(key)
Catch ex As Exception
    Return ex.Message
End Try

Though it works fine on my machine, so I suspect that it's a configuration problem.

Colm
Friday, February 04, 2005

Permissions problem? Is you code running under a user account that has permissions to the remote LDAP server/object?

Also if that's VB.NET code, you'll find it much easier to be using System.DirectoryServices.

Duncan Smart
Thursday, February 10, 2005

>Permissions problem? Is you code running under a user >account that has permissions to the remote LDAP >server/object?

I assume so; I was running it under the same account when I was running it on the server as when I was running it on my machine.

>Also if that's VB.NET code, you'll find it much easier to be >using System.DirectoryServices.

The rest of it is using System.DirectoryServices. I put that bit of code in because there's a Microsoft KB article that purports to fix this problem using those lines.

Colm
Thursday, February 10, 2005

*  Recent Topics

*  Fog Creek Home