473,471 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Update openldap user from c#

2 New Member
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;

return de;
}

I thought it is working properly. But my user update mathod does not work properly.It is as below,

public void ModifyUser(string userDisplayName, string username, string password)
{
DirectoryEntry de = GetDirectoryEntry();
de.Username = username;
de.Password = password;

DirectorySearcher ds = new DirectorySearcher(de);
ds.Filter = ("((objectclass=user)(uid=" + username+ "))");

ds.SearchScope = SearchScope.Subtree;

SearchResult results = ds.FindOne();

if (results != null)
{
try
{
DirectoryEntry updateEntry = results.GetDirectoryEntry();
updateEntry.Properties["password"].Value =password;
updateEntry.CommitChanges();
updateEntry.Close();
}
catch (Exception ex)
{
txt1.Text = ex.ToString();
}
}

de.Close();
}

It gives error as an invalid dn syntax.

Please anyone know about this please help me as soon as possible.

Thanks,
Jagath.
Jul 24 '07 #1
2 5531
kenobewan
4,871 Recognized Expert Specialist
Please copy & paste error message and give line number. Thanks.
Jul 24 '07 #2
DizzleNizzle
1 New Member
Try:

de.Path = "LDAP://DC=YOURDOMAIN,DC=com";

Where YOURDOMAIN is your domain name
Sep 4 '07 #3

Sign in to post your reply or Sign up for a free account.

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,...
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
2
by: Miro | last post by:
I will ask the question first then fumble thru trying to explain myself so i dont waste too much of your time. Question / Statement - Every mdb table needs a PrimaryKey ( or maybe an index - i...
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
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: David | last post by:
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.