-6

I'm trying to make an application in which I need to capture windows username of the client who is accessing it. Can someone help me on this .This is a web application. Thanks in advance.

nanu146
  • 97
  • 1
  • 1
  • 9

1 Answers1

1

I use this on my devops site to get info about client workstation:

    string a1 = Request.ServerVariables["REMOTE_ADDR"];
    Label1.Text = "Microsoft & Browser Settings: \t" + Request.UserAgent;
    Label2.Text = "Web Server IP: " + HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"];
    Label3.Text = "Request Server DNS: " + Request.ServerVariables["REMOTE_ADDR"];
    Label4.Text = "Request Host Address DNS: " + Request.UserHostAddress;
    Label5.Text = "Request Host Name DNS: " + Request.UserHostName;
    Label6.Text = "DNS Forwarding Address: " + Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
    Label7.Text = "Windows ID Owner : " + WindowsIdentity.GetCurrent().Owner.ToString();
    string[] computer_name = System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName.Split(new Char[] { '.' });
    Label8.Text = "Computer Name: " + computer_name[0].ToString();
    Label9.Text = "Request Host Name DNS: " + Request.UserHostName;
    Label10.Text = "Is Local: " + Request.IsLocal.ToString();
    Label11.Text = "URL: " + Request.Url.ToString();

U'd want the windows Id owner, Please mark answer if it helps

bumble_bee_tuna
  • 3,533
  • 7
  • 43
  • 83