i am working on a windows forms .net 3.5 project in c# and the project uses the following line to get the current user:
Created_By = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
On one box the result is hostname\username but on my box the result is username\hostname. Both boxes run Windows 7 Ultimate.
I searched on google but did not find any explanation.
Any explanation or suggestion is apprectiated,
Dawit
According to MSDN the
Nameproperty should return the user name:Is the result produced by the same assembly just on a different machine? And is this machine part of a domain?
Although I have no explanation for the behavior that you are experiencing, you could try the following workaround: