SystemInformation.UserDomainName returning inconsistent values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the System.Windows.Forms.SystemInformation.UserDomainName property
to get the domain name of the logged in user in a database application
written in VB .NET 2003.

The user has recently been migrated to a new domain by our support
department using a process that maintains the SID history for the old domain
account. The user is logged into the new domain when he runs the application.

The UserDomainName property returns the previous domain name most of the
time and only sometimes returns the new domain name under which the user has
logged in. Obviously this is a problem for my application which uses the
domain name to get the user's rights from the database.

Can anyone shed any light on why it's doing this?

Would I be better off using the System.Environment.UserDomain name for this
purpose?
 
Contact your Domain admins, this is not a .NET problem but a problem with
your logon/directory servers.
You can use the System.Environment.UserDomain to get the domain name of the
login domain, but you should only rely on this for Windows applications or
console applications started from within the current interactive logon
session.

Willy.
 
Back
Top