如何获取用户机器。 asp.net中的IP?

问题描述:

如何在asp.net中获取用户机器IP ??

我正在尝试此代码,其中logMachine名称正确,但IP不正确。

How to get User machine IP in asp.net??
I am trying this code, in which logMachine name is got correctly, but IP is incorrect.

String logMachine = System.Net.Dns.GetHostEntry(Request.UserHostAddress).HostName;
String IP Address = Request. UserHostAddress;





查看这些链接。 />


如何获取客户端IP地址 [ ^ ]

如何在ASP.NET中获取用户的客户端IP地址? [ ^ ]

如何在asp.net(C#)中获取客户端IP。 [ ^ ]

在ASP.NET中查找客户端IP地址和位置 [ ^ ]



希望这有帮助。
Hi,

check these links.

how to get client IP address[^]
How to get a user''s client IP address in ASP.NET?[^]
How to get client IP in asp.net(C#).[^]
Find Client IP Address And Location in ASP.NET[^]

hope this helps.


使用这个

use this
string IP= Request.ServerVariables["HTTP_X_FORWARDED_FOR"];