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 3 1368
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(ByV al DomainName As String, ByVal
UserName As String) As String
Dim oDirectory As New DirectoryEntry( "LDAP://" & DomainName)
Dim mySearcher As New DirectorySearch er(oDirectory)
Dim oResult As SearchResult
Dim sResult As String
mySearcher.Sear chScope = SearchScope.Sub tree
mySearcher.Refe rralChasing = ReferralChasing Option.All
mySearcher.Filt er = "(&(objectClass =user)(sAMAccou ntName=" & UserName &
"))"
Try
oResult = mySearcher.Find One
If Not oResult Is Nothing Then
sResult =
oResult.GetDire ctoryEntry.Prop erties("Display Name").Value.To String
End If
Catch ex As Exception
Throw ex
End Try
oResult = Nothing
mySearcher.Disp ose()
oDirectory.Disp ose()
Return sResult
End Function
--
Eric
"Mike" <cs*********@sb cglobal.net> wrote in message
news:Or******** ******@TK2MSFTN GP12.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
are you writing the name anywhere for view?
I need to display the name as well.
"Eric Guillemette" <er***********@ jalphaDeleteThi s.com> wrote in message
news:#h******** ******@TK2MSFTN GP12.phx.gbl... 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(ByV al DomainName As String, ByVal UserName As String) As String Dim oDirectory As New DirectoryEntry( "LDAP://" & DomainName) Dim mySearcher As New DirectorySearch er(oDirectory) Dim oResult As SearchResult Dim sResult As String mySearcher.Sear chScope = SearchScope.Sub tree mySearcher.Refe rralChasing = ReferralChasing Option.All mySearcher.Filt er = "(&(objectClass =user)(sAMAccou ntName=" & UserName
& "))"
Try oResult = mySearcher.Find One If Not oResult Is Nothing Then sResult = oResult.GetDire ctoryEntry.Prop erties("Display Name").Value.To String End If Catch ex As Exception Throw ex End Try
oResult = Nothing mySearcher.Disp ose() oDirectory.Disp ose()
Return sResult End Function
-- Eric
"Mike" <cs*********@sb cglobal.net> wrote in message news:Or******** ******@TK2MSFTN GP12.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
You can do anything you want, this function return a string wich contains
the full name of the user.
Exemple:
'My domain name's: MyDomain
'My UserName's: Eric
Dim s As String = GetFullName("My Domain", "Eric")
The variable 's' will contain "Eric Guillemette" (My full name)
you can put this in a label, combobox, whatever...
--
Eric
"Mike" <cs*********@sb cglobal.net> wrote in message
news:eo******** *****@TK2MSFTNG P12.phx.gbl... are you writing the name anywhere for view? I need to display the name as well.
"Eric Guillemette" <er***********@ jalphaDeleteThi s.com> wrote in message news:#h******** ******@TK2MSFTN GP12.phx.gbl... 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(ByV al DomainName As String, ByVal UserName As String) As String Dim oDirectory As New DirectoryEntry( "LDAP://" & DomainName) Dim mySearcher As New DirectorySearch er(oDirectory) Dim oResult As SearchResult Dim sResult As String mySearcher.Sear chScope = SearchScope.Sub tree mySearcher.Refe rralChasing = ReferralChasing Option.All mySearcher.Filt er = "(&(objectClass =user)(sAMAccou ntName=" &
UserName & "))"
Try oResult = mySearcher.Find One If Not oResult Is Nothing Then sResult = oResult.GetDire ctoryEntry.Prop erties("Display Name").Value.To String End If Catch ex As Exception Throw ex End Try
oResult = Nothing mySearcher.Disp ose() oDirectory.Disp ose()
Return sResult End Function
-- Eric
"Mike" <cs*********@sb cglobal.net> wrote in message news:Or******** ******@TK2MSFTN GP12.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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Victor Lokhmatov |
last post by:
Hello Everyone,
My company has asked me to put a company directory on our intranet site
and I'm trying to use php to extract the users from our active
directory server. I've got everything working, however, when the list
of users is shown in the output, it seems to display the users in the
order their accounts were created, with Administrator obviously being
first. What do you think would be the best way to get the list to be
sorted by...
|
by: Dirk Hagemann |
last post by:
Hi!
I asked here a few weeks ago the same question but the answer of Tim
Golden didn't really help yet.
I'd like to know how to set up a query for all computer-accounts in a
special part of Active Directory by using LDAP.
Example:
all computers with a name like "ABC*" at "..., ou=Production,
|
by: bwahahahaha |
last post by:
Hi,
Is there a library in .NET for LDAP?
Thanks.
|
by: Amar |
last post by:
I am trying to connect to my college LDAP directory using ASP.NET. This LDap
does not have security as it returns only user demographic information.
i do not need to bind with a username or credentials.
What i am trying to do is, i am trying to look up all the information for
the user with user id 'testuser'. The following is the Vb.net code for my
aspx page:
Dim oRoot As DirectoryEntry = New...
|
by: Andrew |
last post by:
Hey all,
Working on revamping our Intranet here and making use of the LDPA, Active
Directory, Directory Services, etc. that .Net provides. I am still fairly
new on this subject, so the problem I have run into I am not sure how to
fix, and really not sure what is causing it.
Here's what is going on (test server - Windows 2003 Server):
I have a page in a folder (under anonymous authentication in IIS6) that has
a link on it that...
| |
by: Sync Walantaji |
last post by:
Hi,
I would like to write a asp.net winform program to authenticate users
on Active Directory.
Can I do this with asp.net if the IIS server is not part of the Active
directory domain?
Is there a working example link that you can point me to?
Thanks
|
by: h2so4 |
last post by:
I want to write a program that will query an ldap directory. can I use adsi
or ado to do that, If yes how ?
tx
--
h2so4
|
by: RTT |
last post by:
here is my current situation. I develop a program on my computer's
localhost. From there i contact Active directory succesfull using a
connectionstring like: LDAP://OU=BE,OU=SE,DC=eu,DC=aagp,DC=corp. This works
fine. My computer is in and OU under the BE folder, and so is my User. I
have no problems connecting to the Active Directory.
But now that my code is finished i want to put it online on one of the
company servers. but when i...
|
by: htperth |
last post by:
Hi all,
Note that I'm new to LDAP and Active Directory and am writing an application that retrieves a simple phone list for all the users in our domain. So far I have the following console app code that seems to work. It queries Active Directory for a phone list and correctly retrieves the names (cn) from the OU. Though I have asked for properties like telephoneNumber, homeNumber, mobile, ipphone, facsimileTelephoneNumber...the properties are...
|
by: htperth |
last post by:
Hi all,
Note that I'm new to LDAP and Active Directory and am writing an application that retrieves a simple phone list for all the users in our domain. So far I have the following console app code that seems to work. It queries Active Directory for a phone list and correctly retrieves the names (cn) from the OU. Though I have asked for properties like telephoneNumber, homeNumber, mobile, ipphone, facsimileTelephoneNumber...the properties are...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |