PDA

Click to See Complete Forum and Search --> : ADSI and ASP.NET Change Password


pfeeney567
Sep 16th, 2003, 09:23 AM
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!

alex_read
Sep 16th, 2003, 10:05 AM
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/Programming/Programming_Languages/Dot_Net/Q_20514340.html

Nigh™aŽe
Sep 24th, 2003, 10:22 AM
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)


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"