获取IPAddress C#

时间:2011-08-02 02:54:30

标签: c# ip-address

如何获取HTTP_X_FORWARDED_FOR IP地址?

  1. HTTP客户端IP

    HttpContext.Current.Request.UserHostAddress.ToString();

  2. HTTP X-FORWARDED FOR //代理IP地址

  3. 远程地址

1 个答案:

答案 0 :(得分:1)

请参阅http://msdn.microsoft.com/en-us/magazine/cc163692.aspx,以便从http请求中检索所谓的“服务器变量”HTTP_X_FORWARDED_FOR ...

有关说明,请参阅http://forums.asp.net/t/1138908.aspx