如何检测,如果我的程序在Active Directory环境中运行? [英] How do I detect if my program runs in an Active Directory environment?

查看:112
本文介绍了如何检测,如果我的程序在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环境中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆