Feb 07, 2021 06:15 AM|aabedeni056|LINK
hello . i have local network with work group .
i want to get ip client that open my website in your browser . my site show ip address client that chrome is right but in ie , mozilla is wrong.
explain(i run my site in iis in windows server 2019, with dns server .when search my website with ipaddress server dont have problem but when search with host name server have problam in mozilla , ie )(for example http:\\192.168.50.86 , http:\\webserver
i write in controller:
public ActionResult GetIpWeb()
string ipAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
// ipAddress = Request.UserHostAddress + " test " ;
ipAddress = Request.ServerVariables["REMOTE_ADDR"];
ViewBag.IPAddress = ipAddress;
in my view :
but i want to change my controller that i can get ip from dns or show in every browsers but i dont khnow how ????
how to use under code in my website ;maybe it be right .
public static void DoGetHostEntry(string hostname)
IPHostEntry host = Dns.GetHostEntry(hostname);
foreach (IPAddress address in host.AddressList)