How to Get the IP Address of any Client System by c# ?

“How to get client ip address in asp.net using c#,Find IP Client address using C# Program,Get Client IP Address and Location in ASP.Net using C#”

Hello friends Today, through this tutorial, we will learn how to get the ip address of any client from the c#.

Friends, we are working on a big project any time, and when using a user login or register we want anyone who registers or logins it, what IP address is doing so, so that we can get the information.

So today we will learn by c# language. There are also some inbuilt code or function in c#. Which are already made up. Which we just have to use correctly.

Apart from c#, you can easily get the IP address of the client’s system by javascript or jquery. But we are talking about how to get the ip address of any client system by c#.

Let’s move on. We’ll explain you step by step. You can see below.

c#

string IPAddress = GetIPAddress();
public string GetIPAddress()
{
IPHostEntry Host = default(IPHostEntry);
string Hostname = null;
Hostname = System.Environment.MachineName;
Host = Dns.GetHostEntry(Hostname);
foreach (IPAddress IP in Host.AddressList) {
if (IP.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) {
IPAddress = Convert.ToString(IP);
}
}
return IPAddress;
}

 

vb.net

Dim Host As IPHostEntry
Dim Hostname As String
Hostname = My.Computer.Name
Host = Dns.GetHostEntry(Hostname)
For Each IP As IPAddress In Host.AddressList
If IP.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork Then
IPAddress = Convert.ToString(IP)
End If
Next
Return IPAddress
Cialis (Tadalafil) är den främsta konkurrenten till Viagra (Sildenafil) på marknaden för erektil dysfunktion. köpa Cialis i Sverige föredras av många på grund av sin längre varaktighet och anses vara det mest kostnadseffektiva varumärkesbaserade ED-läkemedlet som finns tillgängligt i Sverige. Cialis finns i två varianter: Cialis och Cialis Daily, och fyra olika doseringar: 2,5 mg, 5 mg, 10 mg och 20 mg, erbjuder Cialis också en rad olika alternativ för att passa patientens behov.