Discussion Locked

Accessing Sun One Directory Server 5.2 from VB.NET

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi Everyone,

I m presently working on one project in which we will be storing company related and their employee related information in Sun One Directory server 5.2. And We want to access these informations from .NET either VB.NET or C#. It worked fine in Java but now i m trying to make it work in .NET because our project is being developed in .NET Only not in Java. I have Tried one small program in which i m trying to get the users from Sun One Directory Server and the code i have written is :

protected void Button1_Click(object sender, EventArgs e)
{
DirectoryEntry oDE;
oDE = new DirectoryEntry("LDAP://Schawda.calance.com:25243/uid=admin,ou=administrators,ou=topologymanagement,o=netscaperoot,dc=calance,dc=com", "admin", "1", AuthenticationTypes.Secure);
DirectorySearcher deSearch = new DirectorySearcher();
deSearch.SearchRoot = oDE;

try
{
deSearch.Filter = "(&(objectClass=user)(uid=*)";
deSearch.SearchScope = SearchScope.Subtree;
SearchResult results = deSearch.FindOne();
if (!(results == null))
{
oDE = new DirectoryEntry(results.Path, "admin", "1", AuthenticationTypes.Secure);
if (oDE.Properties["cn"] != null && oDE.Properties["cn"].Value != null)
{
TextBox1.Text = oDE.Properties["cn"].Value.ToString();
}
}

}
catch (Exception ex)
{
Response.Write("Error occured: " + ex.Message);
}

}

It works like When i press the Button It will access the users and show it in the TextBox. But when i try to run the above code it gives me an error "The Server is Not Operational" at the line stated: "SearchResult results = deSearch.FindOne();". I dont know why. What may be the reasons. is this code correct or .net does not support DirectorySearcher class and their functions to access Sun One Directory Server 5.2. Please help me as soon as possible. Coz i have a limited time and this is the crucial part of our project.
I will be appreciating your helps.

3 replies

by amol4321

Hey even I need to try similar thing in my proj... did you get any success? Are you using sunone C APIs?

by varmajay

We are trying to connect to Sun one DS with .net. Against active directory. our stuff works.

Please reply if found a solution.
Thanks

by billveron

Hi,
Can anyone help me with the following:

I want to know how to install Sunone directory server and LDAP (college project). And how it works?

This discussion is closed to new replies.