C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Active Directory »

Check the active directory users using .net


Posted Date: 09 Jun 2009    Resource Type: Code Snippets    Category: Active Directory
Author: Shunmuganathan MMember Level: Diamond    
Rating: 1 out of 5Points: 7



To log in the active director we have to check the user id and password availability.We can achieve it through the following name space

using System.DirectoryServices;


The following code block will reach our target.


public bool GetValidUserId(string UserIdP, string PasswordP, string DomainNameP, out bool IsValidUserP)
{
IsValidUserP = false;
try
{
DirectoryEntry deDirEntry = new DirectoryEntry("LDAP://" + DomainNameP,
UserIdP,PasswordP,AuthenticationTypes.Secure);
if (deDirEntry.Name.IndexOf("exception") != -1)
{
IsValidUserP = false;
}
IsValidUserP = true;
}
catch (Exception ex)
{
IsValidUserP = false;
}
return IsValidUserP;
}


This above code will useful for the projects which are using the active directory users

Thanks
Nathan



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Active Directory  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Setting User Permission to folder
Previous Resource: get in file information of a directory
Return to Discussion Resource Index
Post New Resource
Category: Active Directory


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use