How do I detect if my program runs in an Active Directory environment?

前端 未结 5 495
陌清茗
陌清茗 2020-12-31 16:51

How do I detect if my program runs in an Active Directory environment?

I\'m using C# and .Net 2.0

5条回答
  •  醉话见心
    2020-12-31 17:08

    Try getting Environment.UserDomainName and comparing it to Environment.MachineName. If the two are the same then it's likely that the user does not have a domain. If they are not the same then the user is logged into a domain which must have a directory server.

提交回复
热议问题