PC Review


Reply
Thread Tools Rate Thread

Getting Full name from Active directory

 
 
Carlos
Guest
Posts: n/a
 
      15th Jan 2009
I have a rutine that get's the Full user Name from active riectory, it used
to work but now it is not, not sure if some securty update closed something
on AD, Here is my rutine any advice in how to solve it is appreciatted.

public void GetUserName(string strLogin)
{
string str = "";
// Parse the string to check if domain name is present.
int idx = strLogin.IndexOf('\\');
if (idx == -1)
{
idx = strLogin.IndexOf('@');
}
string strDomain;
string strName;
if (idx != -1)
{
strDomain = strLogin.Substring(0, idx);
strName = strLogin.Substring(idx + 1);
}
else
{
strDomain = Environment.MachineName;
strName = strLogin;
}
DirectoryEntry obDirEntry = null;
try
{
obDirEntry = new DirectoryEntry("WinNT://" + strDomain + "/" +
strName);
System.DirectoryServices.PropertyCollection coll =
obDirEntry.Properties;
object obFullName = coll["FullName"].Value;
FullName = obFullName.ToString();
}
catch (Exception ex)
{
str = "" + ex.ToString();
}
}

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Active Directory, Active Directory Federation Services and Microsoft Integration Identiy Server Mas Libman [MSFT] Microsoft Windows 2000 Active Directory 0 6th May 2005 10:55 PM
[Active Directory] On what ground does LDAP connect to Active Directory RTT Microsoft VB .NET 0 12th Apr 2005 04:20 PM
Getting Full NAME from Active Directory Patrick Olurotimi Ige Microsoft ASP .NET 0 8th Mar 2005 07:37 AM
Arguments for 2003 Active directory versus 2000 active directory? =?Utf-8?B?c3RlcGhlbmJiYWtlcg==?= Microsoft Windows 2000 Active Directory 4 23rd Dec 2003 05:40 AM
compatibility between W2K Active Directory and W2k3 Active Directory Dani Microsoft Windows 2000 Active Directory 1 15th Sep 2003 11:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:58 PM.