tags:

views:

383

answers:

2

I'm in a ASP.NET application using Windows Authentication.

I'm using HttpContext.Current.User.Identity.Name to get the username of the currently authenticated user, which gets me a username in the format DOMAIN\USERNAME. This is working fine.

Is there an easy way to convert this to a display name (e.g. "Richard Gadsden") like the one that appears on the top of my start menu in XP?

If I have to, I guess I can go through System.DirectoryServices and query into ADSI, but surely there's an easier way?

+1  A: 

I guess ADSI is the way to go. It's pretty easy. I don't see an easier way. You just query for LDAP://<SID=user-sid> and get the distinguished name property.

Mehrdad Afshari
+2  A: 

Here's a tutorial on just how to do that:

http://www.youcanlearnseries.com/Programming%20Tips/CSharp/LDAPReader.aspx

Wayne Hartman