从 .Net 中的 IP 地址或主机名获取域用户

发布于 2024-08-27 23:20:21 字数 252 浏览 4 评论 0原文

我们正在尝试为 Windows 版 Growl 实施自定义解决方案。我们告诉 Growl 客户端订阅来自我们服务器的通知。然后,服务器通过 GNTP(Growl 消息传递协议)从客户端获取消息。我们需要登录客户端计算机的用户名才能进行数据库查找。 GNTP 不提供此信息。

因此,我们有一个已连接的客户端套接字(以及 IP 地址)和来自该客户端的包含其计算机名称的消息。

有没有可能的方法来确定登录到指定机器的用户的用户名?我们可以访问windows域服务。

We're trying to implement a custom solution for Growl for Windows. We tell the Growl client to subscribe to notifications from our server. The server then gets a message from the client via the GNTP (Growl messaging protocol). We require the name of the user logged into the client machine in order to do database lookups. The GNTP does not provide this information.

So, we have a connected client socket (and thus, IP address) and a message from this client containing its machine name.

Is there any possible way to determine the username of the user who is logged into the specified machine? We have access to windows domain services.

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

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

发布评论

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

评论(2

倚栏听风 2024-09-03 23:20:21

的 Windows 域和当前用户(如果这就是您想要的) ;

这将为您提供使用 System.Security.Principal

        if (WindowsIdentity.GetCurrent().IsAuthenticated)
        {
            string Result = WindowsIdentity.GetCurrent().Name;

This will give you the Windows domain and current user (if that's what you're after)

using System.Security.Principal;

        if (WindowsIdentity.GetCurrent().IsAuthenticated)
        {
            string Result = WindowsIdentity.GetCurrent().Name;
提笔落墨 2024-09-03 23:20:21

我们最终通过在登录时运行客户端应用程序并让我们的服务器知道哪个用户已登录来执行相反的操作(某种程度)。

We ended up doing the reverse (sorta) by having a client-side application run at logon and let our server know which user had logged in.

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