我有网络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>"+
我假设您在这里使用HttpListener / HttpRequestListener,如果是这样,请参阅HttpListener: how to get http user and password? - 接受的答案处理基本身份验证,但它链接到详细说明如何请求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 ...