473,908 Members | 8,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows user name

With

System.Security .Principal.Wind owsIdentity.Get Current().Name

I get the user name of the current Windows user.
But how can I get the full name?

Thanks
Ferdinand
Jan 26 '06 #1
4 12932
Ferdinand,

In order to do this, you would have to call the GetUserNameEx API
function through P/Invoke, passing the value of NameDisplay for the
NameFormat parameter.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Ferdinand Zaubzer" <fe***@gmx.at > wrote in message
news:O3******** *****@tk2msftng p13.phx.gbl...
With

System.Security .Principal.Wind owsIdentity.Get Current().Name

I get the user name of the current Windows user.
But how can I get the full name?

Thanks
Ferdinand

Jan 26 '06 #2

"Ferdinand Zaubzer" <fe***@gmx.at > wrote in message
news:O3******** *****@tk2msftng p13.phx.gbl...
| With
|
| System.Security .Principal.Wind owsIdentity.Get Current().Name
|
| I get the user name of the current Windows user.
| But how can I get the full name?
|
| Thanks
| Ferdinand

Using the System.Director yServices namespace classes:

....
// get fullname of 'username' on 'servername'
using (DirectoryEntry domain = new
DirectoryEntry( "WinNT://servername/username"))
{
string fullName = domain.Properti es["FullName"].Value;
}

Willy.
Jan 26 '06 #3
Willy Denoyette [MVP] wrote:
"Ferdinand Zaubzer" <fe***@gmx.at > wrote in message
news:O3******** *****@tk2msftng p13.phx.gbl...
| With
|
| System.Security .Principal.Wind owsIdentity.Get Current().Name
|
| I get the user name of the current Windows user.
| But how can I get the full name?
|
| Thanks
| Ferdinand

Using the System.Director yServices namespace classes:

...
// get fullname of 'username' on 'servername'
using (DirectoryEntry domain = new
DirectoryEntry( "WinNT://servername/username"))
{
string fullName = domain.Properti es["FullName"].Value;
}


Thanks for the Hint!
But I don't have this System.Director yServices namespace.
Do I have to install any extensions?

Thanks
Ferdinand
Jan 27 '06 #4
No, you have to set a reference to the System.Director yServices assembly.

Willy.

"Ferdinand Zaubzer" <fe***@gmx.at > wrote in message
news:43******** ******@gmx.at.. .
| Willy Denoyette [MVP] wrote:
| > "Ferdinand Zaubzer" <fe***@gmx.at > wrote in message
| > news:O3******** *****@tk2msftng p13.phx.gbl...
| > | With
| > |
| > | System.Security .Principal.Wind owsIdentity.Get Current().Name
| > |
| > | I get the user name of the current Windows user.
| > | But how can I get the full name?
| > |
| > | Thanks
| > | Ferdinand
| >
| > Using the System.Director yServices namespace classes:
| >
| > ...
| > // get fullname of 'username' on 'servername'
| > using (DirectoryEntry domain = new
| > DirectoryEntry( "WinNT://servername/username"))
| > {
| > string fullName = domain.Properti es["FullName"].Value;
| > }
|
| Thanks for the Hint!
| But I don't have this System.Director yServices namespace.
| Do I have to install any extensions?
|
| Thanks
| Ferdinand
Jan 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3716
by: Bob Everland | last post by:
I have an application that is ISAPI and the only way to secure it is through NT permissions. I need to have a way to login to windows authentication so that when I get to the ISAPI application no boxes come up. I want an ASP page to sit between the user and the ISAPI application. The rest of my application is using authentication that is database driven and wouldn't want the users to know the userid and password. Is this possible? If so...
2
15247
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000 Personal disk from the SQL Server 2000 Enterprise kit as this is reported here on the MSDN web site to be the version that is supported on Windows XP. In fact so many of you kind people confess to having succeeded in doing it. I have tried...
3
2357
by: Steven Fox | last post by:
============================================================ About DB2 Administration Tools Environment ============================================================ DB2 administration tools level: Product identifier SQL08015 Level identifier 02060106 Level DB2 v8.1.5.449 Build level s040212 PTF WR21334...
5
2706
by: pberna | last post by:
Dear all, I built a Web Form application to start and stop a Windows Service remotely. I successful tested the application on Windows 2000 server + IIS. I must include the ASPNET user to the Administration group (on server side) to have the necessary authorization to start a Windows Service (I don't understand why "Power User" rights are not enough to do the same thing) Although I'm able to start a service using windows 2000 server...
3
15010
by: Amjad | last post by:
Hi, I just wrote a test Windows Service that creates a text file on startup (please see my code below). The file is never created. Protected Overrides Sub OnStart(ByVal args() As String) Dim swLog As StreamWriter = File.CreateText("C:\myLog.txt") swLog.WriteLine("My Windows Service has just started.") swLog.Close() : swLog.Flush() End Sub
3
7500
by: Chris Paul | last post by:
I'm having trouble with PHP & PostgreSQL/OpenLDAP/Apache on Windows. I've set this up countless times on BSD (piece of cake) but I'm trying to do this on Windows now so that my developer can work on her local machine. Everything looks pretty good. OpenLDAP/cygwin works great. PostgreSQL works great. Apache runs. PHP runs. But when I try to connect to my PostgreSQL server using PHPPgAdmin, I
9
3009
by: Alex | last post by:
Get the Name and Phone Number of the Current Windows User in a .NET Application I am writing a simple .NET (C#) application. It needs to "automatic" get the Name (last, first) and phone number of the current Windows user. I guess the name can be retrieved from the environment -- After I click the Start button of Windows, my name is on the very first line of the popup menu. So, this information is provided by the Windows
5
3321
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
4
5817
by: =?Utf-8?B?QXZhRGV2?= | last post by:
ASP.Net 2. We are migrating to Windows 2008 64 bit Server with IIS 7 from Windows 2003 32 Bit with IIS 6. A few library classes we wrote uses impersonation in code like explained in this article: http://support.microsoft.com/?id=306158#4 This doesn't work in Windows 2008 Server, we receive the following exception:
0
10031
marktang
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...
0
11337
Oralloy
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...
0
10913
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9721
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5930
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...
0
6134
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4770
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
2
4336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3355
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.