Last post Feb 07, 2009 04:31 PM by izharulislam
Feb 05, 2009 11:43 AM|ramzansadiq|LINK
I belive there is a genius who could help me, I want to get users email addresses from active directory group , it doesn' authenticate and get other properties from user, but uanble to find using Group Name ONLY IN DEPLOYMENT works f9 on my computer
My code is as below
Public Shared Function GetGroupEmails(ByVal sGroupName As String, ByRef aspxPage As System.Web.UI.Page) As String()
Dim email(0) As String
Dim sLDAPPath As String = "LDAP:\\JOJO"
' I have also tried the complete path including OUs
Dim entry As DirectoryEntry = New DirectoryEntry(sLDAPPath, UserName, Password, AuthenticationTypes.Secure)
Dim obj As New Object
obj = entry.NativeObject
'Dim entry As New DirectoryEntry(GetPath.GetLDAPPath)
Dim groupSearch As New DirectorySearcher(entry)
groupSearch.Filter = "(SAMAccountName=" + sGroupName + ")"
Dim groupResult As SearchResult = groupSearch.FindOne() ' getting the members who belongs to the concern groupname
get break on FineOne, Error:object reference not set to an instanct of object
aspxPage.Response.Write("Given Path for Approver Eamils =" & sLDAPPath)
Any idea will be greatly appreciate
Feb 07, 2009 04:31 PM|izharulislam|LINK
Just make sure in your virtual directory properties , you have disabled anonymous access.Since this is disabled , when you connect to the active directory it ask for credentials and only then asp worker process will be able to supply the provided credentials
to the active directory.