Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error calling DirectoryEntry.Invoke("SetPassword", new object[]{"password"});

27 views
Skip to first unread message

John Brennan

unread,
Jan 26, 2004, 7:42:40 AM1/26/04
to
Hi I am working with the System.DirectoryServices namespace in .NET. I have
written a method to create a new user in Active Directory. When I try to set
the password for the user I get the following error:

----------------------------------------------------------------------------
----
The filename, directory name, or volume label syntax is incorrect.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: The filename, directory
name, or volume label syntax is incorrect.
----------------------------------------------------------------------------
----

This code is running in an asp.net page and I am binding to the Active
Directory using domain admin credentials. I have tried running the same code
as a console application and it works without any problems so I am guessing
security. Anyone come across anything like this before?

Thanks
John


Joe Kaplan (MVP - ADSI)

unread,
Jan 26, 2004, 11:02:04 AM1/26/04
to
Are you sure that code is failing? Generally, Invoke will always throw a
TargetInvocationException with a COMException as the InnerException
property. That will tell you what actually failed.

I've not seen any instances of this method failing with a
FileNotFoundException.

Joe K.

"John Brennan" <johnvb...@hotmail.com> wrote in message
news:%23aj5AnA...@TK2MSFTNGP11.phx.gbl...

John Brennan

unread,
Jan 26, 2004, 11:10:06 AM1/26/04
to
Hi Joe,
The code definitely works from a console app. I admit it's a
very weird error message to get from calling Invoke.SetPassword but that's
what's happening :-(

"Joe Kaplan (MVP - ADSI)" <joseph....@removethis.accenture.com> wrote
in message news:OtanAXC5...@TK2MSFTNGP11.phx.gbl...

Joe Kaplan (MVP - ADSI)

unread,
Jan 26, 2004, 11:29:02 AM1/26/04
to
If you take out the SetPassword call, does the rest of the code work? What
does the stack trace look like? Can you post the code and show where it
crashes?

Joe K.

"John Brennan" <johnvb...@hotmail.com> wrote in message

news:evwB7aC5...@TK2MSFTNGP10.phx.gbl...

John Brennan

unread,
Jan 26, 2004, 1:32:48 PM1/26/04
to
Joe,
works fine when you don't call SetPassword. I'll send you on the code
now.

Thanks
John


"Joe Kaplan (MVP - ADSI)" <joseph....@removethis.accenture.com> wrote

in message news:eMwPFmC5...@TK2MSFTNGP12.phx.gbl...

John Brennan

unread,
Jan 27, 2004, 6:41:02 AM1/27/04
to
Hi Joe,

I narrowed down the problem to 1 line of code: the binding operation.

This bind causes set password to work:

String Path = "LDAP://localhost:389/CN=Users,DC=Mobhaile,DC=Test"; // can
also use "LDAP://CN=Users,DC=Mobhaile,DC=Test String Username = @"
Mobhaile\Administrator";

String Password = "admin";

DirectoryEntry parent = new DirectoryEntry(Path, Username, Password);

This bind causes set password to fail:

String Path = "LDAP://192.168.10.110:389/CN=Users,DC=Mobhaile,DC=Test";

String Username = @"Mobhaile\Administrator";

String Password = "admin";

DirectoryEntry parent = new DirectoryEntry(Path, Username, Password);

Not sure why this is but both behave consistently every time.

John

"John Brennan" <johnvb...@hotmail.com> wrote in message

news:u2i2qqD5...@TK2MSFTNGP10.phx.gbl...

0 new messages