I want to get ip address of client machine Like I opened website on my machine which is ho开发者_JAVA百科sted on any server So i need IP address of my machine not hosted server IP.
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]
use above syntax in C# otherwise you will get error like
Non-invocable member 'System.Web.HttpRequest.ServerVariables' cannot be used like a method.
''# VB
HttpContext.Current.Request.ServerVariables("REMOTE_ADDR")
// C#
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]
This will get the PUBLIC ip address of the client computer. It will NOT get the LAN IP (192.168...)
精彩评论