How get Account name of computer using ip address

Total Post:70

Points:494
C#  ASP.Net 
C#
 1103  View(s)
Ratings:
Rate this:
I need to track which user account on the same pc is using my software which is an web application. Is this possible? I can only get computer name but not user account name. I need to find out whether it is administrator or guest.
  1. Post:194

    Points:1396
    Re: How get Account name of computer using ip address

    try this code:

        public static string GetIP4Address()
            {
                string IP4Address = String.Empty;
     
                foreach (IPAddress IPA in Dns.GetHostAddresses(HttpContext.Current.Request.UserHostAddress))
                {
                    if (IPA.AddressFamily.ToString() == "InterNetwork")
                    {
                        IP4Address = IPA.ToString();
                        break;
                    }
                }
     
                if (IP4Address != String.Empty)
                {
                    return IP4Address;
                }
     
                foreach (IPAddress IPA in Dns.GetHostAddresses(Dns.GetHostName()))
                {
                    if (IPA.AddressFamily.ToString() == "InterNetwork")
                    {
                        IP4Address = IPA.ToString();
                        break;
                    }
                }
     
                return IP4Address;
            }

      Modified On Apr-05-2018 06:41:00 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!