Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a Active Directory User to a Group

Status
Not open for further replies.

57chevy

Programmer
Jan 4, 2000
29
US
I'm trying to add a Active Directory user account to a Active Directory group on a ASP web application.

My Partial code is:
Try
Dim newgroup As New DirectoryEntry()
Dim strGrpPath As String
strGrpPath = "LDAP://network.ncf.edu/CN=STAFF,OU=Groups,DC=network,DC=ncf,DC=edu"
newgroup.Path = strGrpPath
Dim NewGrpMbr As String = "LDAP://network.ncf.edu/CN=DAN HAYWOOD,OU=ITS,OU=New College,DC=network,DC=ncf,DC=edu"
newgroup.Invoke("Add", NewGrpMbr)
Catch ex As Exception
lblValid.Visible = "True"
lblValid.Text = (ex.Message.ToString)
Finally
newgroup.Close()
End Try

Everything works fine when I step thru the code using the debugger. However, when I run the application without using the debugger, the user is not added to the group and I do not get any errors.
I can't understand why it will not work when it's not in debug mode.....
Can anyone HELP?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top