Find IP Address Behind Proxy Or Client Machine In ASP.NET, If you want
to find the IP address of visitors to your aspx page or application or wanna
retrieve IP for other users than u need to write this code
Using this code we can find IP address of visitor even if visitor is behind any proxy
To find IP address of a machine behind LAN you can use this code
Using this code we can find IP address of visitor even if visitor is behind any proxy
public string IpAddress() { string strIpAddress; strIpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (strIpAddress == null) { strIpAddress = Request.ServerVariables["REMOTE_ADDR"]; } return strIpAddress; }
To find IP address of a machine behind LAN you can use this code
string strHostName = System.Net.Dns.GetHostName(); string clientIPAddress = System.Net.Dns.GetHostAddresses (strHostName).GetValue(1).ToString();
No comments:
Post a Comment