如何知道电脑是否是C#中特定Windows域的一部分? [英] How can I tell if a computer is a part of a specific Windows domain in C#

查看:249
本文介绍了如何知道电脑是否是C#中特定Windows域的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个内部的C#应用​​程序,我想从外部开始部署。我有一些功能,我只想要内部用户可用,但我不想打扰多个版本。我也不想改变内部用户正在使用该程序的方式。



所以,我在想的是:
1)检查该程序正在运行的PC的域。如果是我公司的域名,那么打开内部功能。该程序可能会在与域名断开连接的PC上运行,并且脱机运行。



2)在其上设置密码选项以启用内部功能。



因此,对于域计算机上的内部用户,它看起来与以往完全一样。
对于非域计算机上的内部用户,他们可以打开内部功能。
对于外部用户,他们没有获得内部功能。



实现是域的计算机部分的最佳方法是什么,即使离线在C#?

解决方案

检查 Environment.UserDomainName


I've got an internal C# application that I want to start deploying externally. I've got features that I only want available to internal users, but I don't want to bother with multiple releases. I also don't want to change the way that internal users are currently using the program.

So, what I'm thinking is: 1) Check the domain of the PC that the program is running on. If it's my company's domain, then turn on the internal features. The program may run on PCs that are disconnected from the domain and running offline.

2) Have a password option on top of that to enable internal features.

So, for internal users on domain machines, it looks exactly the same as it always did. For internal users on non-domain machines, they have the ability to turn on the internal features. For external users, they don't get the internal features.

What's the best way to implement the "is the computer part of a domain, even if offline" in C#?

解决方案

Check Environment.UserDomainName.

这篇关于如何知道电脑是否是C#中特定Windows域的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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