G
Guest
If you are using any of the following two calls below, you may not get what
you are looking for.
string domain = System.Environment.UserDomainName;
string domain = SystemInformation.UserDomainName;
I happen to have an account USERX as part of the local domain (MACHINE_NAME)
of my system. The same account name USERX is used for my USERX_DOMAIN domain.
I logged in as USERX_DOMAIN\USERX but the domain returned by those two calls
is MACHINE_NAME.
As a workaround, I am going to use the value of the environment variable
USERDOMAIN, which is correct, to get the correct domain name. How could I
obtain the correct domain name without depending on an overwritable
environment variable?
you are looking for.
string domain = System.Environment.UserDomainName;
string domain = SystemInformation.UserDomainName;
I happen to have an account USERX as part of the local domain (MACHINE_NAME)
of my system. The same account name USERX is used for my USERX_DOMAIN domain.
I logged in as USERX_DOMAIN\USERX but the domain returned by those two calls
is MACHINE_NAME.
As a workaround, I am going to use the value of the environment variable
USERDOMAIN, which is correct, to get the correct domain name. How could I
obtain the correct domain name without depending on an overwritable
environment variable?