如何使用asp.net负载均衡机上获取IP访问者 [英] How to get visitor IP on load balancing machine using asp.net

查看:828
本文介绍了如何使用asp.net负载均衡机上获取IP访问者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们是有两个负载均衡服务器。在我们已经举办了asp.net 3.5应用程序,现在我们正在使用要求userhostaddress获得访问者IP,但它给负载均衡器的IP,而不是真正的IP。任何人都可以有code这一点。

We are having two load balancing server. In that we have hosted a asp.net 3.5 application right now we are using request userhostaddress to get visitor ip but it is giving load balancer ip instead of real ip. Can anyone have code for this.

推荐答案

问题是更多的是与事实,即负载均衡被当枪使。您正在使用什么类型的负载均衡?我知道,与微软ISA服务器有通过对Web服务器将原始的用户IP地址的设置。

The problem is more to do with the fact that the "load balancer" is acting as a proxy. What type of load balancer are you using? I know with Microsoft ISA server there is a setting to pass the original users IP address through to the webserver.

否则,你将不得不编写一个页面倾倒了服务器变量,看是否有被添加额外的服务器变量,让你真正的客户端IP地址。

Otherwise you will have to write a page to dump out the server variables and see if there an extra server variable being added that gives you the real client IP address.

这篇关于如何使用asp.net负载均衡机上获取IP访问者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆