i need to get a client IP Address, which is connect in the LAN, i tried multiple method,
1)Request.UserHostAddress
2)Request.ServerVariables("REMOTE_ADDR")
3) Dim strHostName As String = System.Net.Dns.GetHostName()
Dim clientIPAddress As String = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString()
Response.Write("
.clientIPAddress--" & clientIPAddress)
4)Dim ipHost As IPHostEntry
ipHost = Dns.GetHostEntry(Dns.GetHostName())
Response.Write(ipHost.AddressList(0))
im getting only the server IP address means where the application is hosted, i need Client IP Address which is available in msconfig, like IPAddress, Subnet Mask....
any idea.
Thanks
Regards,
Bahru
MCP (Microsoft Certified Professional) - ASP.NET
MCTS (Microsoft Certified Technology Specialist) - SQL Sever
but i noticed that your application is hosted in a LAN -a corporate LAN I guess- so please check if all the requests that is sent by clients is not passed through a proxy server, because if it is then you will only get the IP of the proxy server
deenindia
Member
46 Points
101 Posts
how to get client IP address
Jan 31, 2010 07:52 AM|LINK
Hello,
i need to get a client IP Address, which is connect in the LAN, i tried multiple method,
1)Request.UserHostAddress
2)Request.ServerVariables("REMOTE_ADDR")
3) Dim strHostName As String = System.Net.Dns.GetHostName()
Dim clientIPAddress As String = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString()
Response.Write("
.clientIPAddress--" & clientIPAddress)
4)Dim ipHost As IPHostEntry
ipHost = Dns.GetHostEntry(Dns.GetHostName())
Response.Write(ipHost.AddressList(0))
im getting only the server IP address means where the application is hosted, i need Client IP Address which is available in msconfig, like IPAddress, Subnet Mask....
any idea.
Thanks
Bahru
MCP (Microsoft Certified Professional) - ASP.NET
MCTS (Microsoft Certified Technology Specialist) - SQL Sever
sreejukg
All-Star
27597 Points
4122 Posts
Re: how to get client IP address
Jan 31, 2010 08:13 AM|LINK
http://forums.asp.net/t/1290632.aspx
My Blog
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: how to get client IP address
Jan 31, 2010 08:39 AM|LINK
check this
https://forums.asp.net/p/1385331/2945922.aspx#2945922
Contact me
Abd0
Member
299 Points
51 Posts
Re: how to get client IP address
Jan 31, 2010 11:34 AM|LINK
you can get the IP using the following code
but i noticed that your application is hosted in a LAN -a corporate LAN I guess- so please check if all the requests that is sent by clients is not passed through a proxy server, because if it is then you will only get the IP of the proxy server
I hope this helps
deenindia
Member
46 Points
101 Posts
Re: how to get client IP address
Feb 01, 2010 04:01 AM|LINK
Hello,
No luck guys, i found the IP address is our firewall IP, now i need to get Client IP behind the firewall.
any solution plz.
Thanks
Bahru
MCP (Microsoft Certified Professional) - ASP.NET
MCTS (Microsoft Certified Technology Specialist) - SQL Sever
deenindia
Member
46 Points
101 Posts
Re: how to get client IP address
Feb 01, 2010 04:06 AM|LINK
Hello,
No luck guys, i found the IP address is our firewall IP, now i need to get Client IP behind the firewall.
any solution plz.
Thanks
Bahru
MCP (Microsoft Certified Professional) - ASP.NET
MCTS (Microsoft Certified Technology Specialist) - SQL Sever
aro sumit
Member
272 Points
39 Posts
Re: how to get client IP address
Feb 01, 2010 04:37 AM|LINK
Hi,
You can capture the Ip Address like this:
HttpRequest currentRequest = HttpContext.Current.Request;
string ipAddress = currentRequest.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (ipAddress == null || ipAddress.ToLower() == "unknown")
ipAddress = currentRequest.ServerVariables["REMOTE_ADDR"];
return ipAddress;
Thanks,
Sumit