Link to home
Start Free TrialLog in
Avatar of NickMalloy
NickMalloyFlag for United States of America

asked on

working with System.DirectoryServices

I have a page where I am calling the directory service name space using the following

<%@ import Namespace="System.DirectoryServices" %>

then I have this in my page

 Dim objDE As New DirectoryServices.DirectoryEntry(CStr(Application("LDAP://CN=Users,DC=mydomain,DC=com")))

I am getting the following error.

Compiler Error Message: BC30002: Type 'DirectoryServices.DirectoryEntry' is not defined.

How can I get around this?
Avatar of daffodils
daffodils

You also need to add a reference to the assembly to your project - just specifying it in the using clause isn't good enough.

Basically.. You need to add "DirectoryServices.dll" as a reference... it needs the assembly reference to be added to the project.. IN ADDITION to the "<%@ import Namespace="" %> clause".
What adding a reference means is that when the application compiles, it KNOWS that it has to include the "DirectoryServices.dll" in the list of files to be compiled.

Go to your project tree, pick your project, and the "References" node below the project node.
Right-click to add a reference, and find the System.DirectoryServices assembly, add it.

Avatar of NickMalloy

ASKER

I am not using Visual studio for this project. I am simply using Dreamweaver MX
Look at the post.. the poster was using DreamWeaver too !

He added Assembly reference in machine.config...
<add assembly="System.DirectoryServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

Also, you can try using the fully qualified name as in put 'DirectoryServices.' before the objects in the code.


so you would put

<add assembly="System.DirectoryServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

at the top of the page or am I still confused.
ASKER CERTIFIED SOLUTION
Avatar of daffodils
daffodils

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
first one doesn't work. Where will I find machine.config?
Should be under C:\WINNT\Microsoft.NET\Framework\v1.1.4322\CONFIG
Or you can search for it on your computer.. there is only 1 per machine.