how to get host ip address in c# code example
Example 1: c# get ip address
var httpClient = new HttpClient();
var ip = await httpClient.GetStringAsync("https://api.ipify.org");
Console.WriteLine($"My public IP address is: {ip}");
Example 2: get sites ip in C#
var url = "https://www.google.com/";
Uri myUri = new Uri(url);
var ip = Dns.GetHostAddresses(myUri.Host)[0];