本文介绍了如何检测我的程序是否在 Active Directory 环境中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检测我的程序是否在 Active Directory 环境中运行?

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

我使用的是 C# 和 .Net 2.0

I'm using C# and .Net 2.0

推荐答案

尝试获取 Environment.UserDomainName 并将其与 Environment.MachineName 进行比较.如果两者相同,则用户可能没有域.如果它们不同,则用户登录到必须具有目录服务器的域.

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.

这篇关于如何检测我的程序是否在 Active Directory 环境中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 00:13