How to find-get IP address of a client system-machine using ?

How to find-get IP address of a client system-machine using ? .Internet protocol is a communication between the nodes. Internet protocol, which is used to track a system host and used address . If you would like to identify the user those who are visiting your website and from which location you are getting the visitors.Also you can store that details in your db 🙂 .Even you can add this functionality in your normal web application to monitor yor page visit and the location.

With the help of Internet protocol address you can track the visitors.Fetch client’s Internet protocol address as soon as he access your web site in of them may use a proxy Internet protocol address. But we can get their Internet protocol address with this simple code.These feature you can implement in your code where you want to to the track of all the visitors as well as with this information you can allow/deny the permission to the visitors.

Here we have two methods to find the Internet protocol address.It is very easy and useful.

using System.Net;// Namespace
//Get IP address of the visitor method
public string GetIpAddress()
string stringIpAddress;
stringIpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (stringIpAddress == null)
stringIpAddress = Request.ServerVariables["REMOTE_ADDR"];
return "Visitor IP Address is "+stringIpAddress;

//Get Lan Connected IP address
public string GetLanIPAddress()
//Get Host Name
string stringHostName = Dns.GetHostName();
//Get Ip Host Entry
IPHostEntry ipHostEntries = Dns.GetHostEntry(stringHostName);
//Get Ip Address From The Ip Host Entry Address List
IPAddress[] arrIpAddress = ipHostEntries.AddressList;
return arrIpAddress[arrIpAddress.Length – 1].ToString();

//Get the Ip Address of the visitor
string strVisitorIpAddress = GetIpAddress();
//Get The Lan Ip Address
string strLanIpAddress = GetLanIPAddress();

— thank you !!

Leave a Reply

Your email address will not be published. Required fields are marked *