We have Request.UserHostAddress to get the IP address in ASP.NET, but this is usually the user\'s ISP\'s IP address, not exactly the user\'s machine IP address
Request.UserHostAddress
use in ashx file
public string getIP(HttpContext c) { string ips = c.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (!string.IsNullOrEmpty(ips)) { return ips.Split(',')[0]; } return c.Request.ServerVariables["REMOTE_ADDR"]; }