So, I have been trying several different methods to retrieve the Windows username so I can write it to a log file when a user performs a certain function.
When I run my app locally, these few lines of code work:
however, once i deploy the application to our intranet, when I test it instead of getting my windows logon I get something like this:
IUSR_SVR-INTRANET
Is it even possible to retrieve their username in this situation, when the app isn't local? All of the different ways I have come across to retrieve a username is enough to make my head spin. Any clarification would be greatly appreciated.
When I run my app locally, these few lines of code work:
VB.NET:
Dim User = System.Security.Principal.WindowsIdentity.GetCurrent.User
Dim UserName = User.Translate(GetType(System.Security.Principal.NTAccount)).Value
System.Environment.UserName 'holds correct username
however, once i deploy the application to our intranet, when I test it instead of getting my windows logon I get something like this:
IUSR_SVR-INTRANET
Is it even possible to retrieve their username in this situation, when the app isn't local? All of the different ways I have come across to retrieve a username is enough to make my head spin. Any clarification would be greatly appreciated.