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;
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.