When I change password of existing domain the given code is working fine but when I'll try to change password of other domain, I get "Exception has been thrown by the target of an invocation" error.
public void ChangePassword(string userDn, string oldpassword, string newpassword)
{
DirectoryEntry user = new DirectoryEntry(userDn);
user.Invoke("ChangePassword", new object[] { oldpassword, newpassword });
user.Close();
}