change password in active directory by webapplication (vb.net)

From: Sara (raf60ir_at_aut.ac.ir)
Date: 04/25/04

  • Next message: Joe Kaplan \(MVP - ADSI\): "Re: change password in active directory by webapplication (vb.net)"
    Date: 25 Apr 2004 08:16:48 -0700
    
    

    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


  • Next message: Joe Kaplan \(MVP - ADSI\): "Re: change password in active directory by webapplication (vb.net)"
  • Quantcast