3

I have network IP address can I know the active user based on the particular IP address

I have under details of the same network

        "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>"+
SAURABH RATHOD
  • 303
  • 3
  • 14

1 Answers1

0

I'm assuming you're using an HttpListener/HttpRequestListener here, and if so please see HttpListener: how to get http user and password? - the accepted answer there deals with basic auth but it links to an article that details how to request Windows auth, so the client should quote the logged in windows user name to your app.

Ps: Looks like you're creating a log? That string concat code is a bit of a mess and would benefit from being tidied up, maybe using interpolated strings:

    $@"Host: {new Program().GetHostName(ip[0].ToString())}<br/>
KeepAlive: {request.KeepAlive}<br/>
Local end point: {request.LocalEndPoint}<br/>
... and so on ...
Caius Jard
  • 72,509
  • 5
  • 49
  • 80