|
-
Jul 25th, 2006, 05:26 AM
#1
Thread Starter
Lively Member
[RESOLVED] How do I get the logged on persons actual name?
How do I get the logged on persons actual name? I already know how to get their logon name but I need their actual first and last name.
Thanks in advance.
-
Jul 25th, 2006, 05:29 AM
#2
Re: How do I get the logged on persons actual name?
I don't think that is available unless the user has entered it somewhere.
One good way is to ask them first what their name is then use that name.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Jul 25th, 2006, 12:07 PM
#3
Addicted Member
Re: How do I get the logged on persons actual name?
 Originally Posted by 2MuchRiceMakesMeSick
How do I get the logged on persons actual name? I already know how to get their logon name but I need their actual first and last name.
Thanks in advance.
Are you using Active Directory and Windows integrated authentication?
"And most of the evils of society can, in fact, be cured through information. We have a society that has been disinformed and based on the disinformation has made irrational choices. And that's what I mean by 'ignorance.' People, who ordinarily might be smart, are deprived of the data by which to make a rational decision, don't have the data to do it."
Frank Zappa
-
Jul 25th, 2006, 04:30 PM
#4
Re: How do I get the logged on persons actual name?
-
Jul 31st, 2006, 03:59 AM
#5
Thread Starter
Lively Member
Re: How do I get the logged on persons actual name?
 Originally Posted by MasterBlaster
Are you using Active Directory and Windows integrated authentication?
Im not sure. its windows XP sp2
 Originally Posted by mendhak
Environment.Username
that returns the USERNAME im looking for the Users actual name
-
Jul 31st, 2006, 04:02 AM
#6
Re: How do I get the logged on persons actual name?
 Originally Posted by 2MuchRiceMakesMeSick
Im not sure. its windows XP sp2
that returns the USERNAME im looking for the Users actual name
Thats what is written in the earlier posts, it will just return the Username. I don't think users full name is available anywhere.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Aug 2nd, 2006, 04:04 AM
#7
Re: How do I get the logged on persons actual name?
Only if it's stored in the ActiveDirectory can you get to the user's "actual name."
In your code, import System.DirectoryServices, instantiate a new DirectoryEntry object, passing it the LDAP path (it usually looks like LDAP://mydomain) and then create a DirectorySearcher which will filter... wait, let me write a code example, brb.
-
Aug 2nd, 2006, 04:09 AM
#8
Re: How do I get the logged on persons actual name?
Code:
DirectoryEntry de = new DirectoryEntry("LDAP://mydomain");
DirectorySearcher ds = new DirectorySearcher(de);
ds.Filter = "(&(objectClass=user)(l=" + Environment.UserName + "))";
foreach(SearchResult sr in ds.FindAll())
{
MessageBox.Show(sr.Properties["givenName"][0].ToString());
MessageBox.Show(sr.Properties["initials"][0].ToString());
MessageBox.Show(sr.Properties["ln"][0].ToString());
}
HTH
-
Aug 3rd, 2006, 10:30 AM
#9
Thread Starter
Lively Member
Re: How do I get the logged on persons actual name?
-
Aug 3rd, 2006, 04:45 PM
#10
Re: How do I get the logged on persons actual name?
No prob. Add Resolved to the thread title so that other people who have the same question in the future can do a search and completely overlook this post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|