Error changing user password using WinNT string connection (and authentication of current password)

I am developing a website that will authenticate the user and change the old password with a new password.

I use a WinNT string connection and a setup password, without checking the old password.

My code is as follows:

'actual setting password
            Dim entryD As New DirectoryEntry("WinNT://" + Environment.MachineName + ",computer")

            Dim NewUser As DirectoryEntry = entryD.Children.Find(username, "user")


            Dim nativeobject As Object = NewUser.NativeObject
            NewUser.Invoke("SetPassword", New Object() {strPassNew})

            NewUser.CommitChanges()
            'setting password ends

This works fine, but the authentication code does not work.

This is as shown below:

'authentication starts
            Dim adsiPath As String

            adsiPath = String.Format("WinNT://{0}/{1},user", domain, username)

            Dim userEntry = New DirectoryEntry(adsiPath, username, password, AuthenticationTypes.Secure)

            'Dim nativeobject1 As Object = userEntry.NativeObject

            Dim newobj As ActiveDs.IADsUser = userEntry.NativeObject


            authent = True

            'authentication ends

This is authenticated, but the exception that it throws is:

logon failure: unknown username or bad password

the first time, but if I do it again, the error is:

"Multiple connections to a server or shared resource by the same user using multiple usernames are not allowed. Disconnect all previous connections to the server or shared resource and try again."

... LDAP, , , . , ?

+3
1

, , . " ...", , ( ), . , , ,

NET SESSION /LIST

cmd , WinNT, - ( , ), .

NET SESSION \\RequestingComputerName /DELETE

. , .

0

All Articles