active directory exeption :"Exception has been thrown by the target of an invocation."

hi

i see in any active directory code the use of invoke methoe such as below:

DirectoryEntry de = new DirectoryEntry("LDAP://192.168.0.1/cn=Users,dc=soheila,dc=org");

DirectoryEntry de1 = de.Children.Add("cn=newUser1", "user");

de1.Invoke("SetPassword", new object[] { "newUser1" });

de1.Invoke("ChangePassword","newUser1","newUser2");

de1.Invoke("Put", new object[] { "Description", "my first entry" });

de1.CommitChanges();

DirectoryEntry de3 = de.Children.Find("cn=group1", "group");

if (de3.Name != "")

de3.Invoke("Add", new object[] { de1.Path.ToString() });

but i can't use none of the invoke methode and each time i use such methode it throw an exeption

that says:"Exception has been thrown by the target of an invocation."

i read an aritcle about this method that says:"Once we have the ADSI object we can call the SetPassword method using the Invoke method of the DirectoryEntry object. This will execute the SetPassword on the ADSI user COM object wrapped by the DirectoryEntry."

but i can't understand the specified line and i guess that i didn't use a thing such as a refrence or some thing such that but i don't know what.......may you please help me

thanks



Answer this question

active directory exeption :"Exception has been thrown by the target of an invocation."

  • Pierre-Yves Troel

    thanks for the info

    www.fukzu.com



  • Chuff

    hi everybody i was thinking that my problem was solved but it seems
    to be harder after i do the procedure that i mention befor it throw
    another exeption that it's inner exeption is:
    (i should say that i disable the password complexity in my server
    but i think that i should disable it in another place such as , idon't
    know but i think that it should be disabled another way or ............
    and i don't know what should i do with that exeption )
    --------------------------------------------------------------------------------------------
    System.Runtime.InteropServices.COMException (0x800708C5):
    The password does not meet the password policy requirements.
    Check the minimum password length, password complexity and
    password history requirements.
    (Exception from HRESULT: 0x800708C5)
    -------------------------------------------------------------------------------------------


  • Brannon

    hi

    System.Reflection.TargetInvocationException was unhandled
    Message="Exception has been thrown by the target of an invocation."
    Source="System.DirectoryServices"
    StackTrace:
    at System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args)
    at ConsoleApplication1.Program.Main(String[] args) in F:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 27
    at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    inner exeption:
    The specified directory object is not bound to a remote resource

    could you please help me with this statement:

    This will execute the SetPassword on the ADSI user COM object wrapped by the DirectoryEntry."

    i can't figure out the meaning of the "red text".

    thanks..........


  • John Wesley Harding

    Hey,

    Have you got any solution for the problem which you have mensioned .

    Bcz I am also getting a problem as you mensioned.

    I you have solved please let me know.

    Regards,

    Rajaram


  • protovision

    Hello

    Did you find a solution to the active directory Change password problem Actually I'm working on the same and getting the same error. Could you let me know the solution if you have rectified the issue.

    Thanks in advance.


  • Gustavo Holloway

    Hi,

    I am also getting the same Error like Exception has been thrown by the target of an invocation. When I do

    object ret = usr.Invoke("SetPassword", RandomPassword.Generate(8,8));

    I am getting the error in the above like Please tell me how to solve this Is there any settings i have to do in SSL or ADAM If yes say what setting has to do and how

    Note: I am gettting the Password as per the password policy only. But still i am getting the same error.

    Please help me

    Regards,

    Rajaram


  • Andrew Mackie

    Hi,

    I am new to AD and I am trying to allow users to change their password after expiration but I am receiving the same error. Can anyone please tell how to solve this.

    Dim mu As MembershipUser = Membership.GetUser(Me.txtUserName.Text)

    mu.ChangePassword(Me.txtOldPwd.Text, Me.txtNewPwd.Text)

    Suren



  • npiacentine

    Any resolution to this problem I am getting the same error. This is the line i get the error on where my password meets all policy requirements.

    User.Invoke("SetPassword", New Object() {Password})


  • Laurent.Guinnard

    The TargetInvocationException that you got has a property called InnerException.

    Can you print out this InnerException to know more about what went wrong


  • mail2amar

    Hi,

    Could any one solve this problem. I am running to the same exception though the password i m trying to set meets the password policy.

    Any help is very much appreciated.

    With Regards,

    Viswa Kalyan.


  • active directory exeption :"Exception has been thrown by the target of an invocation."