Results 1 to 3 of 3

Thread: ADSI and ASP.NET Change Password

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Location
    Columbus, OH
    Posts
    3

    ADSI and ASP.NET Change Password

    First of all I am extremely new to ASP and ASP.Net using VBScript.

    I am trying to use ADSI in Asp.Net and having no such luck. Basically what I'm trying to do seems relatively simple. Allow a user to change his/her password. I've found a number of articles in ASP using VBScript that would change the password but no such luck in Asp.Net using VB. I'm not real sure what to include and how to Dim my oUser object.

    Any and all help with this would be greatly appreciated!!

    Thanks!

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    I have the same problem, the DirectoryServices namespace isn't well documented at all & the list of helpful resources & samples out there on the net is nearly extinct!

    You want to goto the project menu, references option, then under the .net tab, select the System.DirectoryServices option - this'll basically give you the equivalent of the ADSI object libraries you worked with in vbscript.

    Then, check out TDRXander's post over here - I found this very useful for starting off & you can begin to grasp working with the DirectoryServices from there: http://www.experts-exchange.com/Prog..._20514340.html

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3
    Addicted Member Nigh™a®e's Avatar
    Join Date
    Feb 2002
    Location
    Belgium
    Posts
    175
    To change to password first of all u need privileges to do that.
    After changing the password make sure u commit changes.

    Changing the DirectoryEntry.Password will not change the user password. U need to change it in the property collection.

    I dont know the exact property name of the password.
    U must also encrypy the password to the encryption set be the AD. (u can find that back in the property collection)

    Code:
    Dim objRoot As DirectoryEntry = New DirectoryEntry("LDAP://domain.com/DC=domain,DC=com", "username", "password")
    Dim objUser As DirectoryEntry = objRoot.Children.Find("CN=username")
    
    objUser.RefreshCache()
    objUser.Properties.Item("property").Value = "newvalue"
    objUser.CommitChanges()
    If u know the exact property name, this code should be working, but its not smart to give a webpage write access to AD.
    If u really want to use ADSI make organization unit for the accounts.
    LDAP://domain.com/OU=Web,DC=domain,DC=com"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width