473,667 Members | 2,642 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Director yServices.Direc toryEntry entryPC = new
System.Director yServices.Direc toryEntry();

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

string sFilter =
String.Format(" (&(objectClass= pen)(descriptio n={0}))", PenIDTextBox.Te xt);
entryPC.Authent icationType =
System.Director yServices.Authe nticationTypes. Anonymous;

System.Director yServices.Direc torySearcher ds = new
System.Director yServices.Direc torySearcher(en tryPC);
ds.Filter = sFilter;

ds.SearchScope = System.Director yServices.Searc hScope.Subtree;

System.Director yServices.Searc hResult 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=0x 000....
(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 1839

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

Similar topics

0
2381
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, "uid=testuser,cn=users,dc=test,dc=net", $new); I am authenticated and the operation succeeds (no errors), but the password does not change. How can I properly change a userPassword value in OpenLDAP?
8
6178
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 resources(diskspace/memory). Perhaps that anyone ever compiled sucessfully the OpenLDAP, an opensource distribution. THanks
1
5344
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 = ( base => 'DC=xy', scope => "subtree", filter => '(&(objectClass=user)(objectCategory=Person))',
1
3145
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” ”cn=admin,ou=People,dc=test,dc=com" "secretje" AuthenticationTypes.ServerBin
0
1219
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
26642
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 userEntry = new DirectoryEntry( ldapPath, username, password, AuthenticationTypes.Anonymous); //Bind to the native AdsObject to force authentication.
1
2208
by: Gert Albertse | last post by:
Is it possible to use forms authentication against an OpenLDAP server
2
5546
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() { DirectoryEntry de = new DirectoryEntry(); de.Path = "LDAP://192.248.8.239/OU=People,DC=example,DC=com"; de.AuthenticationType = AuthenticationTypes.ServerBind;
0
1108
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 knows about that help me......... Regards, Jagath.
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8367
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8889
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8570
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.