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
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();
Find IP Address In ASP.NET Behind Proxy
Posted by
Unknown
If you like this post than join us or share
Labels: C#
Subscribe to:
Post Comments (Atom)
14 comments:
This comment has been removed by a blog administrator.
This comment has been removed by a blog administrator.
Hi,
How 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,
How do I use the second option in my aspx page?
Thanks
This comment has been removed by a blog administrator.
This comment has been removed by a blog administrator.
System.Net.Dns.GetHostAddresses
(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
Thanks in advance
Shiva
i want to know the details about the ip address and client using browser and which location client open my website
Access Type (Browser),Location (IP address) [ ? ] Date/Time all these details in my website by using the c# and asp.net
tell me how to add more than 10 category
To solve the runtime error of Index was outside the bounds of the array use
string ipaddress = System.Net.Dns.GetHostAddresses(hostname).GetValue(0).ToString();
This comment has been removed by a blog administrator.
how to find public ip address ??
Post a Comment