Error invoking password to LDAP

M

Marco Widjojo

I was successful to add a new user to active directory.
However, the set password is failed in the server.

I ran adding user to AD in my local machine and it worked
perfectly.But, when I try it in our server it failed. The
actual coding of adding the user is successful, however
when invoking password is failed.

Thus in the server, the user is added but not the password

My local machine and the server have .Net framework1.1.
My local machine Windows XP and server, WIndows 2000
advanced server

Below is my code(C#) to set a password for a new user.

object obRet = dsUser.Invoke("SetPassword", new object[]
{txtPwd.Text});
dsUser.CommitChanges();

The server gives me(NOT my local mchine):
"Exception has been thrown by the target of an invocation"

and I don't understand what is that mean?

Any help would be greatly appreciated?
Please
 
M

Marc Scheuner [MVP ADSI]

Below is my code(C#) to set a password for a new user.
object obRet = dsUser.Invoke("SetPassword", new object[]
{txtPwd.Text});
dsUser.CommitChanges();

The server gives me(NOT my local mchine):
"Exception has been thrown by the target of an invocation"

Can you get the whole exception text, including the inner exception??

E.g. can you print out Exception.ToString() instead of just
Exception.Message?

Also, you might want to call the SetPassword thing AFTER you've
committed the changes to the AD store - you first need to create the
user, before you can set a password on it.

Marc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
M

Marco Widjojo

Before I called the invoke set password, I already
committed the changes to create a user, that's why the
user is added to the AD but not the password (invoke
failed).

Exception.message:
Exception has been thrown by the target of an invocation

Exception.tostring():

System.Reflection.TargetInvocationException: Exception
has been thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x8007052E):
Logon failure: unknown user name or bad password. --- End
of inner exception stack trace --- at
System.RuntimeType.InvokeDispMethod(String name,
BindingFlags invokeAttr, Object target, Object[] args,
Boolean[] byrefModifiers, Int32 culture, String[]
namedParameters) at System.RuntimeType.InvokeMember
(String name, BindingFlags invokeAttr, Binder binder,
Object target, Object[] args, ParameterModifier[]
modifiers, CultureInfo culture, String[] namedParameters)
at System.Type.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args)
at System.DirectoryServices.DirectoryEntry.Invoke(String
methodName, Object[] args) at
rhodon.UserManagement.addUser.btnSubmit_Click(Object
sender, EventArgs e) in
c:\inetpub\wwwroot\rhodon\usermanagement\adduser.aspx.cs:l
ine 122

Thank you very much for your attention

-----Original Message-----
Below is my code(C#) to set a password for a new user.

object obRet = dsUser.Invoke("SetPassword", new object []
{txtPwd.Text});
dsUser.CommitChanges();

The server gives me(NOT my local mchine):
"Exception has been thrown by the target of an
invocation"

Can you get the whole exception text, including the inner exception??

E.g. can you print out Exception.ToString() instead of just
Exception.Message?

Also, you might want to call the SetPassword thing AFTER you've
committed the changes to the AD store - you first need to create the
user, before you can set a password on it.

Marc

========================================================= =======
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at) inova.ch
.
 
W

Willy Denoyette [MVP]

I see you are trying this from asp.net right?
In order to call "setpassword" you need a secure channel between the client and the DC, so you need to use SSL or the client has to
be a domain member.

Willy.

Marco Widjojo said:
Before I called the invoke set password, I already
committed the changes to create a user, that's why the
user is added to the AD but not the password (invoke
failed).

Exception.message:
Exception has been thrown by the target of an invocation

Exception.tostring():

System.Reflection.TargetInvocationException: Exception
has been thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x8007052E):
Logon failure: unknown user name or bad password. --- End
of inner exception stack trace --- at
System.RuntimeType.InvokeDispMethod(String name,
BindingFlags invokeAttr, Object target, Object[] args,
Boolean[] byrefModifiers, Int32 culture, String[]
namedParameters) at System.RuntimeType.InvokeMember
(String name, BindingFlags invokeAttr, Binder binder,
Object target, Object[] args, ParameterModifier[]
modifiers, CultureInfo culture, String[] namedParameters)
at System.Type.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args)
at System.DirectoryServices.DirectoryEntry.Invoke(String
methodName, Object[] args) at
rhodon.UserManagement.addUser.btnSubmit_Click(Object
sender, EventArgs e) in
c:\inetpub\wwwroot\rhodon\usermanagement\adduser.aspx.cs:l
ine 122

Thank you very much for your attention

-----Original Message-----
Below is my code(C#) to set a password for a new user.

object obRet = dsUser.Invoke("SetPassword", new object []
{txtPwd.Text});
dsUser.CommitChanges();

The server gives me(NOT my local mchine):
"Exception has been thrown by the target of an
invocation"

Can you get the whole exception text, including the inner exception??

E.g. can you print out Exception.ToString() instead of just
Exception.Message?

Also, you might want to call the SetPassword thing AFTER you've
committed the changes to the AD store - you first need to create the
user, before you can set a password on it.

Marc

========================================================= =======
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at) inova.ch
.
 
B

Bill

Why then will this call work from a local (developer) machine, but not
work from a server?

Bill

Willy Denoyette said:
I see you are trying this from asp.net right?
In order to call "setpassword" you need a secure channel between the client and the DC, so you need to use SSL or the client has to
be a domain member.

Willy.

Marco Widjojo said:
Before I called the invoke set password, I already
committed the changes to create a user, that's why the
user is added to the AD but not the password (invoke
failed).

Exception.message:
Exception has been thrown by the target of an invocation

Exception.tostring():

System.Reflection.TargetInvocationException: Exception
has been thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x8007052E):
Logon failure: unknown user name or bad password. --- End
of inner exception stack trace --- at
System.RuntimeType.InvokeDispMethod(String name,
BindingFlags invokeAttr, Object target, Object[] args,
Boolean[] byrefModifiers, Int32 culture, String[]
namedParameters) at System.RuntimeType.InvokeMember
(String name, BindingFlags invokeAttr, Binder binder,
Object target, Object[] args, ParameterModifier[]
modifiers, CultureInfo culture, String[] namedParameters)
at System.Type.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args)
at System.DirectoryServices.DirectoryEntry.Invoke(String
methodName, Object[] args) at
rhodon.UserManagement.addUser.btnSubmit_Click(Object
sender, EventArgs e) in
c:\inetpub\wwwroot\rhodon\usermanagement\adduser.aspx.cs:l
ine 122

Thank you very much for your attention

-----Original Message-----
Below is my code(C#) to set a password for a new user.

object obRet = dsUser.Invoke("SetPassword", new object []
{txtPwd.Text});
dsUser.CommitChanges();

The server gives me(NOT my local mchine):
"Exception has been thrown by the target of an invocation"

Can you get the whole exception text, including the inner exception??

E.g. can you print out Exception.ToString() instead of just
Exception.Message?

Also, you might want to call the SetPassword thing AFTER you've
committed the changes to the AD store - you first need to create the
user, before you can set a password on it.

Marc

========================================================= =======
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at) inova.ch
.
 

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

Top