User1586656181 posted
Hello Sharat,
As far as your problem is concerned I can give you some code which I am not sure how far it can assist you.
But you can try with the following as per your Domain Name. Mainly we use LDAP or GC for authentication purpose. So if your organisation has some other Directory Service Provider than you have to use that.
Anyways, in C# I have this
string _FILTER =
"(&(ObjectClass={0})(sAMAccountName={1}))";
string ADsFilter =
string.Format(_FILTER,
"person", userid);
DirectoryEntry root =
new DirectoryEntry("GC://DC=<domainname>,DC=AD");
root.AuthenticationType = AuthenticationTypes.Secure;
//Below credentials is a must to search in Active Directory.
root.Username = userid; //userid is string which is passed as parameter
root.Password = pwd; //password is string which is passed as parameter
//Now we declare the Searcher and use it to retrive the needed values
DirectorySearcher searcher =
new DirectorySearcher(root);
searcher.SearchScope = SearchScope.Subtree;
searcher.ReferralChasing = ReferralChasingOption.All;
searcher.Filter = ADsFilter;
SearchResult search = searcher.FindOne();
DirectoryEntry ADsObject = search.GetDirectoryEntry();
//Retrieving the value from AD object
string strUserId = ADsObject.Username.ToString();
string strdDisplayName = ADsObject.Properties["displayName"].Value.ToString();
For more help you may contact me at
tarak_shah@satyam.com
bye...