Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / October 2005

Tip: Looking for answers? Try searching our database.

SetPassword en SSL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Natasja - 11 Oct 2005 12:56 GMT
Hi,
I've been trying to change the password of an active directory user through
code. This computer executing the code is not the domain controller. the
problem is that I keep getting an unauthorized access exception. I've been
told I have to use the SSL authentication type to get this to work. Is there
any documentation available on how SSL can be set up on active directory? On
how to do this? What should be installed on which computer?

Example:
Dim NewUser As DirectoryEntry = AD.Children.Add("TestUser1", "user")
NewUser.Invoke("SetPassword", "NewPassword")

Signature

Natasja

Joe Kaplan (MVP - ADSI) - 11 Oct 2005 15:52 GMT
Two problems with the code right off:

First, the username should be specified as "CN=xxxx", as the Add method with
the LDAP provider takes a relative distinguished name:

Dim NewUser As DirectoryEntry = AD.Children.Add("CN=TestUser1", "user")

Second, yu should save the user first before trying to set the password as
the object needs to be persisted to the directory before the password can be
set:

NewUser.CommitChanges()
NewUser.Invoke("SetPassword", "NewPassword")

Depending on whether the domain is AD 2000 or 2003, you may need to set the
sAMAccountName attribute before you do the initial save.  2003 will create a
default value, but 2000 will not.  Note that using the default value is
probably a bad idea as that will essentially give the user a semi-random
logon name.  I recommend always setting it explicitly.

NewUser.Properties("sAMAccountName").Value = "TestUser1"

If you want to make sure you use SSL to bind to the directory, make sure
AuthenticationTypes.SecureSocketsLayer is set on the parent object before it
is bound to the directory.  Note that your AD must be configured with an SSL
certificate to use SSL/LDAP.

HTH,

Joe K.

> Hi,
> I've been trying to change the password of an active directory user
[quoted text clipped - 10 lines]
> Dim NewUser As DirectoryEntry = AD.Children.Add("TestUser1", "user")
> NewUser.Invoke("SetPassword", "NewPassword")
Natasja - 11 Oct 2005 16:03 GMT
Hi Joe,

how do I configure AD with an SSL certificate? Can you point me to any
documentation on how to set this up?

Thanks,

Signature

Natasja

> Two problems with the code right off:
>
[quoted text clipped - 41 lines]
> > Dim NewUser As DirectoryEntry = AD.Children.Add("TestUser1", "user")
> > NewUser.Invoke("SetPassword", "NewPassword")
Joe Kaplan (MVP - ADSI) - 11 Oct 2005 18:07 GMT
http://support.microsoft.com/default.aspx?scid=kb;en-us;247078

Google will turn up lots of other documents as well for configuring with
third party certificates and such.

Note that you may not need SSL support on your DC.  SetPassword works best
with SSL support, but it does not absolutely require it.  If you can get it
to work without SSL, you may be better off.

Joe K.

> Hi Joe,
>
[quoted text clipped - 58 lines]
>> > Dim NewUser As DirectoryEntry = AD.Children.Add("TestUser1", "user")
>> > NewUser.Invoke("SetPassword", "NewPassword")

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.