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();
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteHi,
ReplyDeleteHow do i use the second option:
"To find IP address of a machine behind LAN you can use this code"
inmy code behind of an aspx page?
Thanks.
Hi,
ReplyDeleteHow do I use the second option in my aspx page?
Thanks
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteSystem.Net.Dns.GetHostAddresses
ReplyDelete(strHostName).GetValue(1).ToString();
How do I use the above code in my aspx page?
if i use the above code in my aspx means
Index was outside the bounds of the array.
Now what can i do? I need Dns Ip address
Hi, I use the Viusal C# Express edition. As far as I know the 2005 version that I am using is based on .Net 2.0, so it should have the System.Management namespace. However, I can't use that namespace... There is no intellisense or anything that popos up after I type it out... Do I need to have a server version of the OS to have System.Management
ReplyDeleteThanks in advance
Shiva
i want to know the details about the ip address and client using browser and which location client open my website
ReplyDeleteAccess Type (Browser),Location (IP address) [ ? ] Date/Time all these details in my website by using the c# and asp.net
ReplyDeletetell me how to add more than 10 category
ReplyDeleteTo solve the runtime error of Index was outside the bounds of the array use
ReplyDeletestring ipaddress = System.Net.Dns.GetHostAddresses(hostname).GetValue(0).ToString();
This comment has been removed by a blog administrator.
ReplyDeletehow to find public ip address ??
ReplyDelete