确定域用户的主机或IP

发布于 2024-08-27 14:24:42 字数 98 浏览 3 评论 0原文

在 Windows 域上,有什么方法可以获取给定域用户名的主机名或 IP 地址吗? C# API 会很棒。

示例: string GetUserIP(字符串用户名);

Is there any way, on a windows domain, to get hostname or IP address given the domain username? C# APIs would be great.

example: string GetUserIP(string username);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泪意 2024-09-03 14:24:42

简而言之,您无法找到该信息,因为 IP 地址是分配给计算机而不是用户的。现在您也许能够找到用户登录的计算机的 IP 地址。第一步是与域管理员交谈。查明他们是否正在记录信息。他们还可以指导您如何搜索日志(这是在很大程度上假设域管理员会合作,但不能保证)。

现在已经说过,如果其他人连接到您的应用程序,那么从他们连接的位置获取 IP 地址相对容易。您只需在建立连接后检查连接中的连接属性即可。

The short answer is that you can't find the information because the IP address is assigned to a computer and not a user. Now you might be able to find out the IP address of the computer a user logged into. The first step would be to talk with the domain administrator. Find out if they are logging the information. They may also be able to point you to how to search the log (that is with a huge assumption that the domain admin will cooperate which is NOT guaranteed).

Now having said that if others are connecting to your application it is relatively easy to get the IP address from where they are connecting. You simply exam the connection property in the connection after it has been established.

肤浅与狂妄 2024-09-03 14:24:42

我最终创建了一个在登录时运行的客户端应用程序(通过添加正确的注册表项。参见此处)您还可以将其作为登录脚本的一部分来实现。这连接到远程服务并报告用户名。然后,服务器应用程序维护登录用户和 IP 的字典。

I ended up creating a client-side application that runs on logon (by adding the correct registry key. See Here) You could also implement this as part of a logon script. This connected to the remote service and reported the username. The server application then maintained a dictionary of logged-on users and IPs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文