473,706 Members | 2,576 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 12922
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
3707
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
15222
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
2348
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
2694
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
14936
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
7487
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
3001
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
3304
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
5810
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
8692
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,...
0
9276
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
9141
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...
1
9038
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,...
0
7895
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...
1
6607
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4441
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...
1
3140
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
3
2084
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.