HOW GET ACCOUNT NAME OF COMPUTER USING IP ADDRESS

Simons Hood

Total Post:70

Points:494
Posted by  Simons Hood
ASP.Net  C# 
C#
 840  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. Kamlakar Singh

    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;

            }

Answer

NEWSLETTER

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