Re: Setting a password on an AD account...
- From: Joe <Joe@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 22 Feb 2007 07:48:18 -0800
Willy,
I forgot to include the stack trace.
" at System.RuntimeType.InvokeDispMethod(String name,
BindingFlags invokeAttr, Object target, Object[] args,
Boolean[] byrefModifiers, Int32 culture,
String[] namedParameters)\r\n
at System.RuntimeType.InvokeMember(String name,
BindingFlags invokeAttr, Binder binder, Object target,
Object[] args, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParameters)\r\n
at System.Type.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target,
Object[] args)\r\n
at System.DirectoryServices.DirectoryEntry.Invoke
(String methodName, Object[] args)\r\n
at Project.FormName.btnCreateUser_ServerClick
(Object sender, EventArgs e) in
h:\\inetpub\\wwwroot\\Project\\secure\\FormName.aspx.cs:line 166"
Line 166 is the line where the password is set.
I hope that this helps.
"Joe" wrote:
Willy,.
This is a Web App as I stated initially. The user does get created but is
disabled. No problems there.
DirectoryEntry parent = new DirectoryEntry(
"LDAP://dc.mydomain.local/OU=MyOU,DC=mydomain,DC=local",
szUsername,
szPassword,
AuthenticationTypes.Secure);
DirectoryEntry user = parent.Children.Add("CN=" + szFName + " " + szLName,
"user");
using(user)
{
...Set properties...
user.CommitChanges();
AdsUserFlags newValue = AdsUserFlags.NormalAccount;
user.Properties["userAccountControl"].Value = newValue;
user.Invoke("SetPassword", new object[]{szPassword});
user.CommitChanges();
user.Dispose();
parent.Dispose();
}
The client is NOT a member of the domain. This code did work when it
was a Windows App.
Here are the errors:
ex.Message: Reason: Exception has been thrown by the target of an invocation.
ex.InnerException.Message: The network path was not found.
Thanks for the help.
"Joe" <Joe@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3A262B0E-81E7-437E-BEB3-3292BDEB3801@xxxxxxxxxxxxxxxx
Will,
Thanks. I am definitely connecting with AuthenticationTypes.Secure.
Could it be the level of .NET?
Guess not.
How does your objectpath looks like (LDAP://....), please specy whether the server name is a
domain name or a DC name.
Is the client (machine) a member of the AD domain you are binding to?
What's the exact callers context, is this called from a console or a Windows application or
something else?
What's the exact Exception message and if possible post a stack trace.
What happens when you don't set the password, are the objects created?
Willy.
- References:
- Re: Setting a password on an AD account...
- From: Willy Denoyette [MVP]
- Re: Setting a password on an AD account...
- From: Willy Denoyette [MVP]
- Re: Setting a password on an AD account...
- Prev by Date: RE: Serial Communication Port Help
- Next by Date: RE: xPath does not work when the XML Document has xmlns
- Previous by thread: Re: Setting a password on an AD account...
- Next by thread: Re: Setting a password on an AD account...
- Index(es):
Relevant Pages
|