This function do exactly what you need :0)
I'm using this function with WinForms, but I think that's will work in
Asp.Net too.
Public Shared Function GetFullName(ByVal DomainName As String, ByVal
UserName As String) As String
Dim oDirectory As New DirectoryEntry("LDAP://" & DomainName)
Dim mySearcher As New DirectorySearcher(oDirectory)
Dim oResult As SearchResult
Dim sResult As String
mySearcher.SearchScope = SearchScope.Subtree
mySearcher.ReferralChasing = ReferralChasingOption.All
mySearcher.Filter = "(&(objectClass=user)(sAMAccountName=" & UserName &
"))"
Try
oResult = mySearcher.FindOne
If Not oResult Is Nothing Then
sResult =
oResult.GetDirectoryEntry.Properties("DisplayName" ).Value.ToString
End If
Catch ex As Exception
Throw ex
End Try
oResult = Nothing
mySearcher.Dispose()
oDirectory.Dispose()
Return sResult
End Function
--
Eric
"Mike" <cs*********@sbcglobal.net> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
In my current asp.net application i'm getting the user network short name
and displaying that on the screen. What I want is the users Full name and
display that instear. How can i go about doing that, would I use LDAP or
Active directory to do that?
I never had to do this and not sure how to do it or where to start
looking.
Ex: this is what i get now.
jsmith - network logon ID
what I want is:
John Smith.
is this possible?
thx