473,586 Members | 2,682 Online
Bytes | Software Development & Data Engineering Community
+ 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 GetDirectoryEnt ry()
{
DirectoryEntry de = new DirectoryEntry( );
de.Path = "LDAP://192.248.8.239/OU=People,DC=ex ample,DC=com";
de.Authenticati onType = AuthenticationT ypes.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(stri ng userDisplayName , string username, string password)
{
DirectoryEntry de = GetDirectoryEnt ry();
de.Username = username;
de.Password = password;

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

ds.SearchScope = SearchScope.Sub tree;

SearchResult results = ds.FindOne();

if (results != null)
{
try
{
DirectoryEntry updateEntry = results.GetDire ctoryEntry();
updateEntry.Pro perties["password"].Value =password;
updateEntry.Com mitChanges();
updateEntry.Clo se();
}
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 5543
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,D C=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
2379
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...
1
5333
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
3138
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
1217
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
3098
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 havnt tested the index yet ) so you can use an .UPDATE( dataTable ) on the data adapter. Otherwise you will get an exception error. Is this...
3
26628
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
2207
by: Gert Albertse | last post by:
Is it possible to use forms authentication against an OpenLDAP server
0
1106
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
1832
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 C#. System.DirectoryServices.DirectoryEntry entryPC = new System.DirectoryServices.DirectoryEntry();
0
7912
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...
0
7839
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...
1
7959
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...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3837
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...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
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...

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.