473,322 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

C# to OpenLDAP

Hi all,

I have a problem. Been pulling my hair out all day with this. Had a number
of errors, but now I am so close. This is connecting to OpenLDAP on a linux
box. My app is an ASP.NET app in C#.
System.DirectoryServices.DirectoryEntry entryPC = new
System.DirectoryServices.DirectoryEntry();

entryPC.Path =
"LDAP://MyLDAPServer389/ou=pens,dc=anotes,dc=com";

string sFilter =
String.Format("(&(objectClass=pen)(description={0} ))", PenIDTextBox.Text);
entryPC.AuthenticationType =
System.DirectoryServices.AuthenticationTypes.Anony mous;

System.DirectoryServices.DirectorySearcher ds = new
System.DirectoryServices.DirectorySearcher(entryPC );
ds.Filter = sFilter;

ds.SearchScope = System.DirectoryServices.SearchScope.Subtree;

System.DirectoryServices.SearchResult sr = null;

bool SRFailed = false;

try
{
sr = ds.FindOne();
}
catch(Exception ex)
{
SRFailed = true;
}
The path is correct as I can connect to it with an LDAP Browser.

When I run it, I am dropping into the catch and getting an error "The
parameter is incorrect", which is about as helpful as praying for it to
work.
Inside my ou=pens, I have a branch (an endpoint) of serialNumber=0x000....
(hex number). There are two of these. Inside these, I have various
attributes, 3 objectClass (one of them has the value "pen" and a description
attribute with the value that I am searching for.

If I put my sFilter value in my LDAP Browser search routine, then I get the
result (but only if I scan the subtree).

Absolutely any help, even if you don't know the answer but possible have
noticed something I may have missed will be helpful.

Thanks.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
Jun 27 '08 #1
0 1818

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: stegger | last post by:
I am trying to update a users password on OpenLDAP: $new = '{md5}' . base64_encode(pack('H*', md5($newpass_in_plaintext))); $this->result = ldap_modify($connection,...
8
by: Useko Netsumi | last post by:
Hi, I'm wondering if anyone has any clue where to get an ldap server for windows? I'm trying to avoid installing the resource hog Active Directory on my server with limited...
1
by: Durairaj Avasi | last post by:
#!/usr/bin/perl -w use Net::LDAP; use Net::LDAP::Util qw(ldap_error_name ldap_error_text); my $ldap = Net::LDAP->new('xy.webdurai.net', port=> 389) or die "$@"; $ldap->debug(15); my @args = (...
1
by: jdelimon | last post by:
Hello I use the following code to connect to an openldap server This works just fine _deRoot = new DirectoryEntry "LDAP://ws244501.test.com/ou=People,dc=test,dc=com”...
0
by: mmatthe | last post by:
Hi, one short question: it is possible to administer sessions in an OpenLDAP-server instead of files oder MySQL? If yes, can you give me a hint? THX
3
by: dorrit.Riemenschneider | last post by:
I need to validate a user with username and password against our OpenLDAP active directory. This is my code: Private bool ValidateUser (string username, string password) { DirectoryEntry...
1
by: Gert Albertse | last post by:
Is it possible to use forms authentication against an OpenLDAP server
2
by: Jagath84 | last post by:
Hi all, I want to update openldap directory from c#. I used following code for make Directory entry as below. public static DirectoryEntry GetDirectoryEntry() { ...
0
by: Jagath84 | last post by:
Hey, Anyone know how retrieve client ip addresses from openldap who are already logged in to the openldap domain. Is there any possible query those result can be obtained? Please someone...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.