S
Sara
Dear Sir,
I want to change password of users in active directory by asp.net
form.this is my code, but i recieve error could anyone help me to
solve it. thanks
Protected WithEvents newpass As System.Web.UI.WebControls.TextBox
Protected WithEvents btn1 As System.Web.UI.WebControls.Button
Protected WithEvents username As System.Web.UI.WebControls.TextBox
Protected WithEvents oldpass As System.Web.UI.WebControls.TextBox
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn1.Click
Dim dom As DirectoryEntry = New
DirectoryEntry("LDAP://Hosnieh_Rafiee", "Hosnieh_Rafiee\admin11",
"bbb")
Dim entry As DirectoryEntry = New
DirectoryEntry("LDAP://Hosnieh_Rafiee", username.Text, oldpass.Text)
Dim search As New DirectorySearcher(entry)
Dim result As SearchResult = search.FindOne
'If entry.Password = oldpass.Text Then
Dim b As String
entry.Invoke("setPassword", "newpassword")
entry.CommitChanges()
Response.Write(entry.Password)
Response.Write("successful")
'Else
' Response.Write("your username or password is incorrect")
'End If
End Sub
I want to change password of users in active directory by asp.net
form.this is my code, but i recieve error could anyone help me to
solve it. thanks
Protected WithEvents newpass As System.Web.UI.WebControls.TextBox
Protected WithEvents btn1 As System.Web.UI.WebControls.Button
Protected WithEvents username As System.Web.UI.WebControls.TextBox
Protected WithEvents oldpass As System.Web.UI.WebControls.TextBox
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn1.Click
Dim dom As DirectoryEntry = New
DirectoryEntry("LDAP://Hosnieh_Rafiee", "Hosnieh_Rafiee\admin11",
"bbb")
Dim entry As DirectoryEntry = New
DirectoryEntry("LDAP://Hosnieh_Rafiee", username.Text, oldpass.Text)
Dim search As New DirectorySearcher(entry)
Dim result As SearchResult = search.FindOne
'If entry.Password = oldpass.Text Then
Dim b As String
entry.Invoke("setPassword", "newpassword")
entry.CommitChanges()
Response.Write(entry.Password)
Response.Write("successful")
'Else
' Response.Write("your username or password is incorrect")
'End If
End Sub