Get local IP address

前端 未结 26 2917
野的像风
野的像风 2020-11-22 10:07

In the internet there are several places that show you how to get an IP address. And a lot of them look like this example:

String strHostName = string.Empty;         


        
26条回答
  •  庸人自扰
    2020-11-22 10:56

    In addition just simple code for getting Client Ip:

            public static string getclientIP()
            {
                var HostIP = HttpContext.Current != null ? HttpContext.Current.Request.UserHostAddress : "";
                return HostIP;
            }
    

    Hope it's help you.

提交回复
热议问题