Active Directory - setPassword method error

  • Thread starter Thread starter knea
  • Start date Start date
K

knea

Hi,

I noticed a bunch of postings about getting error while invoking the
"setPassword" method. I am getting similar error and any help would
be appreciated. The error that I am getting is:

-------------------------------------------------
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 ---
-------------------------------------------------

Before I call my "setpassword" method, I have already enabled the
account and have called CommitChanges() method. I am using ASP.Net
with VB.Net.

I read somewhere that I need to use a secure connection to call the
"setpassword" method. Is this true? if yes then please give me some
more details as to how I can connect securely to my Active Directory
server. Passing AuthenticationType = Secure didnot work.

Thanks
Knea
 
You may have to give some code to help others start working on this
issue and also as to how you have setup your web application.

Does it do Impersonation with Windows Authentication. Is IIS configured
to use Basic Authentication etc.

Regards,

Trevor Benedict R
MCSD

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
The code for this error is below:

Dim objDirEnt As New DirectoryServices.DirectoryEntry("LDAP://" &
s_ServerName, s_ADAuthUsername, s_ADAuthPassword)

Dim s_NewUser_User As DirectoryServices.DirectoryEntry
Try
s_NewUser_User = objDirEnt.Children.Add("CN=" &
s_UniqueCN, "user")
With s_NewUser_User.Properties
If s_EmployeeEmail <> "" Then .Item("mail").Value =
s_EmployeeEmail
If s_FullName <> "" Then .Item("sAMAccountName").Value =
s_FullName
End With

s_NewUser_User.Properties("userAccountControl").Value =
544
s_NewUser_User.CommitChanges()

Dim s_User As DirectoryServices.DirectoryEntry
s_User = LDAP_Connect(Me.s_PORTALLOCAL_ServerName
& "/CN=" & s_UniqueCN
& ",OU=ZackOU,OU=External,DC=PORTAL,DC=LOCAL",
Me.s_PORTALLOCAL_ADAuthUsername,
Me.s_PORTALLOCAL_ADAuthPassword)

Try
s_User.Invoke("setPassword", New Object()
{"Password"})
Catch e As Exception
s_ReturnMsg = "Error in Setting Password. Error: "
& e.ToString
End Try
s_User.CommitChanges()

Thanks
Knea


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Back
Top