asp.net - Getting client values of IIS Server Variables in Load Balanced Environment -


i have intranet asp.net web application in need ip of client's machine. vis following code:

httpcontext.current.request.servervariables.item("remote_host") 

it used work when asp.net site hosted on single server. once got load balancer installed , migrated our apps web farm, code above returns ip of load balancer device , not of client anymore.

i working networking folks determine can configured differently load balancer, in meantime wondering if there way client's ip other using iis server variable? or other suggestions?

thank you!

which load balancer using? sounds if load balancer acting proxy web traffic, hence reason source appears come lb. hardware load balancers built on linux platforms , there provision transparency if kernel supports it: http://www.mjmwired.net/kernel/documentation/networking/tproxy.txt however, require root access unit , downtime. may worth mentioning vendor's support team if don't have ideas.

another (hopefully easier) option: may able configure load balancer's proxy write client's source ip in http x-forwarded-for header: http://en.wikipedia.org/wiki/x-forwarded-for , you'll able read header via asp.net in similar way:

request.servervariables("x-forwarded-for") 

this may work if proxy doing this.

really options depend on load balancer capable of, , configurable. note list of common hardware vendors @ bottom of wiki page above.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -