如何从同一网络中的IP地址获取活动用户

时间:2019-04-12 05:07:32

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

我有网络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>"+

1 个答案:

答案 0 :(得分:0)

我假设您在此处使用的是HttpListener / HttpRequestListener,如果可以,请参见HttpListener: how to get http user and password?-那里接受的答案涉及基本身份验证,但是它链接到详细说明如何请求Windows身份验证的文章,因此,客户端应在您的应用程序中引用登录的Windows用户名。

Ps:您似乎正在创建日志?字符串连接代码有点混乱,可以通过整理,也许可以使用插值字符串来受益:

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