开发者

Fetch IP Address

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...)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜