Home > DeveloperSection > Forums > How get Account name of computer using ip address
Simons Hood
Simons Hood

Total Post:70

Points:494
Posted on    October-06-2014 12:52 AM

 C# ASP.Net  C# 
Ratings:


 1 Reply(s)
 547  View(s)
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.


Kamlakar Singh
Kamlakar Singh

Total Post:194

Points:1396
Posted on    October-06-2014 12:53 AM

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;

        }


Don't want to miss updates? Please click the below button!

Follow MindStick