首页 > 解决方案 > 如何从同一网络中的IP地址获取活动用户

问题描述

我有网络 IP 地址我可以根据特定的 IP 地址知道活动用户吗

我在同一个网络的详细信息下

        "host"+"-" + new Program().GetHostName(ip[0].ToString()).ToString() + "<br>" +
    "KeepAlive" + request.KeepAlive + "<br>" +
    "Local end point: {0}" + "-" + request.LocalEndPoint.ToString() + "<br>" +
    "Remote end point: {0}" + "-" + "--" + "<br>" +
    "Is local? {0}" + "-" + request.IsLocal + "<br>" +
    "HTTP method: {0}" + "-" + request.HttpMethod + "<br>" +
    "Protocol version: {0}" + "-" + request.ProtocolVersion + "<br>" +
    "Is authenticated: {0}" + "-" + request.IsAuthenticated + "<br>" +
    "Is secure: {0}" + "<br>" + request.IsSecureConnection + "<br>" +
    //"username " + "-"+ username + "<br>"+

标签: c#ldapwindows-server-2008ldap-query

解决方案


我假设您在这里使用 HttpListener/HttpRequestListener,如果是,请参阅HttpListener:如何获取 http 用户和密码?- 那里接受的答案涉及基本身份验证,但它链接到详细说明如何请求 Windows 身份验证的文章,因此客户端应将登录的 Windows 用户名引用到您的应用程序。

Ps:看起来你正在创建一个日志?那个字符串 concat 代码有点乱,可以从整理中受益,也许使用插值字符串:

    $@"Host: {new Program().GetHostName(ip[0].ToString())}<br/>
KeepAlive: {request.KeepAlive}<br/>
Local end point: {request.LocalEndPoint}<br/>
... and so on ...

推荐阅读