benvegiard
Programmer
System.Environment.UserDomainName
Hi All…
We recently ran into an unexpected behavior with the System.Environment.UserDomainName function. We are calling this function to a routine to validate a username/password against the network. Our domain is JC_MGC.
Oddly enough, on our training machines, it would not authenticate. After playing around with it a bit, we found that it would authenticate if the username (login account) and machine name differed. If they were the same, it would not authenticate.
After further testing, we found that when logged onto a machine with a user-account that was the same as the machine name, the System.Environment.UserDomainName function returned the name of the machine (e.g. local machine domain). However, when logging in, we know we had selected “JC_MGC” as the domain to login against.
I cannot find any documentation on this behavior. Does anyone know why it works this way? Also, does anyone know of a way to extract the domain the current user is logged into without using the System.Environment.UserDomainName function?
Thanks,
Ben
Hi All…
We recently ran into an unexpected behavior with the System.Environment.UserDomainName function. We are calling this function to a routine to validate a username/password against the network. Our domain is JC_MGC.
Oddly enough, on our training machines, it would not authenticate. After playing around with it a bit, we found that it would authenticate if the username (login account) and machine name differed. If they were the same, it would not authenticate.
After further testing, we found that when logged onto a machine with a user-account that was the same as the machine name, the System.Environment.UserDomainName function returned the name of the machine (e.g. local machine domain). However, when logging in, we know we had selected “JC_MGC” as the domain to login against.
I cannot find any documentation on this behavior. Does anyone know why it works this way? Also, does anyone know of a way to extract the domain the current user is logged into without using the System.Environment.UserDomainName function?
Thanks,
Ben