How to find client IP?
Web Development
3
Posts
2
Posters
0
Views
1
Watching
-
Hi Frd's Can anybody tell me how to find a client system IP address which is in a LAN and connected to internet. Here i want to find out both public IP and private IP. Please help me.
Thanks & Regards, Anil Chelasani
static public String GetClientIP(Page page) { //Find the users own IP String strIpAddress = String.Empty; try { strIpAddress = page.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (strIpAddress == null) strIpAddress = page.Request.ServerVariables["REMOTE_ADDR"]; if (strIpAddress == null) strIpAddress = page.Request.UserHostAddress; } catch { strIpAddress = "IP address not Found"; } return strIpAddress; }
In Word you can only store 2 bytes. That is why I use Writer.
-
static public String GetClientIP(Page page) { //Find the users own IP String strIpAddress = String.Empty; try { strIpAddress = page.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (strIpAddress == null) strIpAddress = page.Request.ServerVariables["REMOTE_ADDR"]; if (strIpAddress == null) strIpAddress = page.Request.UserHostAddress; } catch { strIpAddress = "IP address not Found"; } return strIpAddress; }
In Word you can only store 2 bytes. That is why I use Writer.