Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

working with System.DirectoryServices

Posted on 2004-10-25
8
Medium Priority
?
1,056 Views
Last Modified: 2008-01-09
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?
0
Comment
Question by:NickMalloy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 8

Expert Comment

by:daffodils
ID: 12404853
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.

0
 

Author Comment

by:NickMalloy
ID: 12404870
I am not using Visual studio for this project. I am simply using Dreamweaver MX
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 8

Expert Comment

by:daffodils
ID: 12404912
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.


0
 

Author Comment

by:NickMalloy
ID: 12405006
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.
0
 
LVL 8

Accepted Solution

by:
daffodils earned 500 total points
ID: 12405045
No.. I was saying there two things:

First in your code file:
1. Remove the <%@ import Namespace="System.DirectoryServices" %> statement from the top.
2. Write your code as:
Dim objDE As New System.DirectoryServices.DirectoryEntry(CStr(Application("LDAP://CN=Users,DC=mydomain,DC=com")))

.. IF the above still doesn't work, then
1. Open machine.config and search for "System.DirectoryServices"
2. If not found, then add the following line at the end of other <add assembly=......> statements.
<add assembly="System.DirectoryServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
0
 

Author Comment

by:NickMalloy
ID: 12405082
first one doesn't work. Where will I find machine.config?
0
 
LVL 8

Expert Comment

by:daffodils
ID: 12405129
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.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question