Click here to Skip to main content
15,913,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need to get the details of online or logged user in an AD (Active Directory) through LDAP in ASP page using C#.

Thanks in advance

Regards,
Krishnamoorthy S
Posted
Comments
arshad alam 24-Sep-12 2:17am    
You can get the user list of AD using LDAP. but for logged in user you have to use wmi query
krishnaspmoorthy 24-Sep-12 5:33am    
Hi,

I need the list of AD logged users.


Thanks in advance.

Regards,
Krishnamoorthy S
krishnaspmoorthy 19-Dec-12 1:59am    
can u please explain the wmi query?

1 solution

create the funciton , HERE
DirectoryEntry entry
is actually the LDAP Setting and in the
C#
search.PropertiesToLoad.Add("samAccountName");

you can load what ever information you need from AD like First Name , LastName and Country


  object obj = entry.NativeObject;
 string filterCriteria = "(&(objectCategory=user)(objectClass=person)(sAMAccountName=" + /* Logged in user name */+ "))";
 DirectorySearcher search = new DirectorySearcher(entry);
 search.Filter = filterCriteria;
 search.PropertiesToLoad.Add("samAccountName");
 SearchResult result = search.FindOne();
 if (result == null)
 {
    //Load your required values
 }
}
 
Share this answer
 
Comments
krishnaspmoorthy 24-Sep-12 5:33am    
Hi,

I need the list of AD logged users


Thanks in advance.

Regards,
Krishnamoorthy S
Rickin Kane 24-Sep-12 6:12am    
code will help you to fetch the records in the result
krishnaspmoorthy 24-Sep-12 6:28am    
You mean the above code...!!!
Rickin Kane 24-Sep-12 6:30am    
yes , thats my code i used for my own use , but u can tweak it a little to get ur desired output
krishnaspmoorthy 24-Sep-12 6:31am    
Ok i'll try....

Anyway thanks for ur gr8 tym...!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900