473,320 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

username retrieval

Hi, I am new to .net and c#
How do I retrieve the windows username?
if possible please provide me some sample code

Regards,

Vincent
Nov 16 '05 #1
2 1104
Vincent,

If you want the name of the currently logged in user, you can use the
static UserName property on the Environment class.

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

"Vincent Haakmat" <vh******@nagico.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi, I am new to .net and c#
How do I retrieve the windows username?
if possible please provide me some sample code

Regards,

Vincent

Nov 16 '05 #2
Thanks for Nicholas's greate response!

Hi Vincent,

Nicholas has provided the best way to get the current username. Besides,
you can also get the username and domain name with the following:

System.Security.Principal.WindowsIdentity.GetCurre nt().Name;

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #3

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

Similar topics

5
by: news | last post by:
Hi, I am pretty new to PHP I want to do the following but I have been unable to find good info/ or sample code on it; please help; - retrieve a gif/jpeg image using PHP from another site -...
2
by: Bob | last post by:
x-no-archive:yes Installing Oracle 9i client v9.2.00.00 on w2k pro wrkstn which is member of AD Domain. When testing connection - getting error: Unable to connect SQLState=S1000 ORA-12638: ...
1
by: Lyle H. Gray | last post by:
We load a table from a text file using Data Transformation Services. The source file is already sorted by primary key order. After the DTS load, the default retrieval order on the target table...
3
by: Ahmed Qurashi | last post by:
Does anyone know of any Libraries using .NET for the Indexing, Search, and Retrieval of Text Documents? I am searching for API's to analyze a set of docs and convert text into indexable tokens,...
12
by: grace | last post by:
i am wondering why my database retrieval becomes too slow...we set up a new server (ubuntu, breezy badger) machine where we transferred all our files from the old server.. Our new server uses Asus...
0
by: JosAH | last post by:
Greetings, Introduction At the end of the last Compiler article part I stated that I wanted to write about text processing. I had no idea what exactly to talk about; until my wife commanded...
0
by: JosAH | last post by:
Greetings, welcome back; above we discussed the peripherals of the Library class: loading and saving such an instantiation of it, the BookMark interface and then some. This part of the article...
0
by: Hul Tytus | last post by:
comp.infosystems.www.authoring.html file retrieval services on the web? Do file retrieval services exist on the internet that allow a web site at www.this.com to have html code as below? Keeping...
0
by: Hul Tytus | last post by:
comp.infosystems.www.authoring.html file retrieval services on the web Do file retrieval services exist on the internet that allow a web site at www.this.com to have html code as below? Keeping...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.