Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System.Environment.UserDomainName

Status
Not open for further replies.

benvegiard

Programmer
May 15, 2003
63
US
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
 
Maybe the user that you logged in with, has another account with the same name on the local computer?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top