473,387 Members | 1,863 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,387 software developers and data experts.

Writing to AD using LDAP/C#

Hello,

I am developing an application in C# using VS .NET 2005 that
will be accessing and updating Active Directory via LDAP. So, far I
have written the main portions, but now I am stuck on the code to
CHANGE and ADD/DELETE entries.

I'm pretty sure my problem is security related, but I can't
quite narrow it down. I bind to the root of the AD domain using an
account that is a Domain Admin on the AD server itself, HOWEVER....
the actual application is running on a user's workstation presumably
as the local system account.

Is there a way to "impersonate" this domain admin user like you
can in ASP.NET applications? I can do everything I want to do with AD
except CHANGE it in any way.

Thanks in advance for your help.....

Mar 30 '07 #1
3 3264
Hello,
The Following link may help
http://msdn2.microsoft.com/en-us/lib...25(VS.71).aspx

Regards,
Husam Al-A'araj

"Robert Iver" wrote:
Hello,

I am developing an application in C# using VS .NET 2005 that
will be accessing and updating Active Directory via LDAP. So, far I
have written the main portions, but now I am stuck on the code to
CHANGE and ADD/DELETE entries.

I'm pretty sure my problem is security related, but I can't
quite narrow it down. I bind to the root of the AD domain using an
account that is a Domain Admin on the AD server itself, HOWEVER....
the actual application is running on a user's workstation presumably
as the local system account.

Is there a way to "impersonate" this domain admin user like you
can in ASP.NET applications? I can do everything I want to do with AD
except CHANGE it in any way.

Thanks in advance for your help.....

Mar 30 '07 #2
It may not. The OP is asking about LDAP. The link you give uses WinNT:

<quote>
"This walkthrough used the WinNT service provider for Active Directory.
Other services are available, including the Lightweight Directory Access
Protocol (LDAP), the Novell NetWare Directory Service (NDS), and the Novell
Netware 3.x service (NWCOMPAT). Each provider provides a different set of
objects to allow you to examine and manipulate directories."
</quote>

If the OP is binding using a domain admin account, his code should work - at
least as far as security is concerned. What error messages are being
returned? Programming AD is a nightmare. There are so many things that can
go wrong. For a start there are three ways of accessing attributes when
using LDAP:
* Using the managed DirectoryEntry object
* Using the ADSI COM object wrapped by the DirectoryEntry object by calling
Invoke() on the DirectoryEntry object
* Using the wrapped COM object directly by obtaining it from a
DirectoryEntry object

Some attributes require one way: some require another. Or so it seems to
us.

Additionally, it seems that additions/alterations have to be made in some
specific, but unspecified in the documentation, order.

And finally, it seems that these requirements are different depending on
whether or not you are adding or updating an entry.
Peter

"Husam Al-A''araj" <Hu**********@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.com...
Hello,
The Following link may help
http://msdn2.microsoft.com/en-us/lib...25(VS.71).aspx

Regards,
Husam Al-A'araj

"Robert Iver" wrote:
>Hello,

I am developing an application in C# using VS .NET 2005 that
will be accessing and updating Active Directory via LDAP. So, far I
have written the main portions, but now I am stuck on the code to
CHANGE and ADD/DELETE entries.

I'm pretty sure my problem is security related, but I can't
quite narrow it down. I bind to the root of the AD domain using an
account that is a Domain Admin on the AD server itself, HOWEVER....
the actual application is running on a user's workstation presumably
as the local system account.

Is there a way to "impersonate" this domain admin user like you
can in ASP.NET applications? I can do everything I want to do with AD
except CHANGE it in any way.

Thanks in advance for your help.....


Mar 30 '07 #3
I am developing an application in C# using VS .NET 2005 that
>will be accessing and updating Active Directory via LDAP. So, far I
have written the main portions, but now I am stuck on the code to
CHANGE and ADD/DELETE entries.
Can you show us some code that attempts to update your AD? Maybe it's
something else entirely... Try to limit your posting to just the
relevant pieces of code (no fluff around it), and please also try to
spell out all LDAP paths etc. that you're using - we can't look into
your variables listed in your code - thanks!

Marc

Apr 2 '07 #4

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

Similar topics

0
by: paul b | last post by:
Hello, I am writing some LDAP-scripts in PHP. One of the scripts has to add new objects(urls) to the tree using the ldap_add command. The problem is that I cannot add objects of the type...
3
by: Frank Drebin | last post by:
I have a need to allow other LDAP-compliant customers that want to integrate thier own single-signon to be able to map to accounts in my SQL2K database. Since they are using LDAP - I'm assuming I'd...
7
by: Sync Walantaji | last post by:
Hi, I would like to write a asp.net winform program to authenticate users on Active Directory. Can I do this with asp.net if the IIS server is not part of the Active directory domain? Is...
0
by: Johan | last post by:
Hi I'm using WMI to set and remove folderpermissions and it sems to work fine, sometimes. I start by having the folderpermissons manuly set to Everyone and Everone has full rights. When I'm...
2
by: Jay | last post by:
Hi, This is Jay Mehta. I have this problem when using LDAP. I extract names and EmailId's of all those present from LDAP and populate in a datagrid. Now when run locally, it is running...
0
by: choukse | last post by:
Hi All, I am trying to bind to ADAM instance with a windows user through JNDI and it keeps failing. My ADAM and AD is running on same Windows 2k3 server. But, through LDP I am able to bind with...
0
by: rbukkara | last post by:
Hi, I have got the following error while trying to add a user in the LDAP Directory. javax.naming.NameNotFoundException: ; remaining name 'uid=vassila,ou=People,dc=cs,dc=uno,dc=edu' I have...
1
by: zmunoz | last post by:
I am working on a script using ADSI via COM in PHP. The script works for the most part when I query a user using the following function: function passwordExpires($userDN) { $comLDAP = new...
0
by: Sells, Fred | last post by:
I'm running python 2.5 (or 2.4) in an XP environment. I downloaded and installed the .dll's from OpenLDAP-2.4.8+OpenSSL-0.9.8g-Win32.zip and copied the .dll's in c:/windows/system32 as instructed...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
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...

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.