Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 3rd, 2004, 11:07 PM
Authorized User
 
Join Date: Apr 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sara_1981
Default create users/deleting users in active directory

Hi there,
I have problem in making user in active directory, could anyone help me, my code is as follow, if I use WINNT I will recieve the error that "access deny" in line invoke.commitechanges , if I use LDAP , it gives me another kind of exception in this line rootDN = DirectCast(ad.Properties("defaultNamingContext").V alue, String could anyone please help me. thanks in advance.

Public Sub Makeuser(ByVal DcDNS As String, ByVal username As String, ByVal newPassword As String)



                Dim rootDN As String

        Dim ad As DirectoryEntry





        ad = New DirectoryEntry(String.Format("LDAP://{0}/ad", DcDNS), "myadminaccount", "myadmin password", AuthenticationTypes.Secure Or AuthenticationTypes.Sealing)

        rootDN = DirectCast(ad.Properties("defaultNamingContext").V alue, String)

        Dim NewUser As DirectoryEntry = ad.Children.Add(username, "user")

        NewUser.Invoke("SetPassword", New Object() {newPassword})

        NewUser.Invoke("Put", New Object() {"Description", "Test User from .NET"})



        NewUser.CommitChanges()

        NewUser.Close()

        Dim grp As DirectoryEntry



        grp = ad.Children.Find("Guests", "group")

        If grp.Name <> "" Then

            grp.Invoke("Add", New Object() {NewUser.Path.ToString()})

        End If

    End Sub





Regards
Sara
__________________
Regards
Sara
 
Old October 7th, 2004, 11:52 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Hi Sara.

Hope this code will help you....

DirectorySearcher DSESearcher = new DirectorySearcher();
String RootDSE = DSESearcher.SearchRoot.Path;
RootDSE = RootDSE.Insert (7, "CN=Users,");

DirectoryEntry myDE = new DirectoryEntry(RootDSE, LDAPUserName, LDAPPassword);
DirectoryEntries myEntries = myDE.Children;
DirectoryEntry oUserDE = myEntries.Add("CN=" + strUserName, "user");

oUserDE.CommitChanges();

Regards
Ganesh
 
Old October 8th, 2004, 11:05 PM
Authorized User
 
Join Date: Apr 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sara_1981
Default

thanks very much for your Help:):)

Regards
Sara
 
Old October 10th, 2004, 11:06 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

cheers

Regards
Ganesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Create SQL Server users programmatically? Dmitriy Pro VB.NET 2002/2003 4 October 29th, 2008 03:14 PM
Listing Active Directory Users wallacr C# 2005 0 December 4th, 2006 10:41 AM
Monitoring users login/logout to my active directo Gu General .NET 0 June 10th, 2005 11:49 AM
Question about active directory users apalmero Access VBA 0 November 4th, 2003 03:13 PM
Create / Delete Active Directory Users Kilian Pro VB 6 0 June 12th, 2003 09:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.