>>Hi,
>>
>>I find that it is much easier to get username currently logged into the PC using VFP and C#.
>>
>>In VFP a call to GetEnv("UserName") returns the username of the person currently logged into the PC. Works well.
>>
>>In C# using Environment.UserName returns the name of the server. Same value no matter who is logged in.
>>
>>How could I get the username using C#?
>>
>>TIA
>
>Environment.UserName
>
>
https://docs.microsoft.com/en-us/dotnet/api/system.environment.username?view=netcore-3.1The Environment.UserName returns the server name; not the user name. Even though the article says it should. I test it myself and asked one of the IT people. The same result (negative).
Thanks.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham