Comexception when setting domain password with directoryentry in a ASP.NET project

M

Marek Kopanski

Hallo,

I have to change a user password in my ASP.NET project.
In the first step I was trying to change my own passwort (as example) in
Active Directory on my Server, but already at this point I get problems.
Can somebody help me?

1. I use following fragment of code:
-----------------------------------
DirectoryEntry DirEntry;

DirEntry = new DirectoryEntry(@"WinNT://XXX-DOMAIN","MyName","MyPassword");

DirEntry.Invoke("setPassword", "testtest");

@"WinNT://XXX-DOMAIN"," is the name of the Server

2. Error
--------------------------------

The line:

DirEntry.Invoke("setPassword", "testtest");

fires an error:

System.Runtime.InteropServices.COMException: unknown name.

Can somebody tell me, what I am doing wrong?

Greetings

Marek
 
G

Guest

Hi Marek,

you are probably getting this error because by default ASP.NET account runs
with minimum privileges and hence it doesn't have access to such functions in
the AD. Either use impersonation or pass on the credentials of an user who
has the rights to change user passwords and it should work.

HTH.

Kaustav Neogy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top