Hai
I am read your question first my best wishes to your project
Now I am answer your question
Refer the following C# code that will satisfy you
class AnswerForbbetan
{
  public static void Main()
        {
            //Following will print the User Name of Computer
            Console.WriteLine("\t\t Welcome Mr/Mrs : "+
System.Environment.UserName  );

        }
}


On Dec 13, 6:41 am, BBetances <[email protected]> wrote:
> Here's a good question, and the answer is probably right in from of
> me.
>
> I want to retrieve the name of the user that is logged in on a certain
> PC from C#. Let me give you an example.
>
> I'm making a media player (web based) that can play videos, music, and
> images. As many of you know, the default location of most people's
> media is "C:/Users/'Username'/Documents/Music || Movies || Pictures".
> The username variable is the name you use to login to your computer.
> For example, mine is Administrator. I use AD, but for those that don't
> connect to a domain, I want to be able to retrieve that name as well.
> This name will be added into the above string to define a default
> location to load media from. So, lets say someone uses Windows XP
> Home, which does'nt allow connection to a domain, and they login with
> the name "Jojo9696". How can I find that name in C#, so I can
> construct my path string?
>
> I know this question is kind of complicated, or maybe just asked
> wrong, but think of it like this: When you click your start menu, and
> it tells you the name you used to log into your computer, I want to
> retrieve that name.
>
> Any ideas?

Reply via email to