Re: How can I get the IP address of the host Web Server into a Ses

Tech-Archive recommends: Speed Up your PC by fixing your registry



if the firewall (or load balancer) is doing nat translation (which it should
be), then its not available (as only the firewall knows it).

your best bet is to add to the ipaddress to the web.config as a setting

-- bruce (sqlwork.com)


"John Kotuby" wrote:

Thanks for the reply Mark,

I think that will give me the actual IP address of the Server box that the
Web Application is running on. That would work for me if the was directly
connected to the Internet.
However, in this situation, the Web Server is behind a firewall and being
accessed via NAT.

What I am really looking for is the Public IP Address that is used in the
request to get to the Router that then finds the Server behind the firewall.

I am thinking that it is contained somewhere in the HttpRequest object just
as the Me.Request.Headers.Item("Host").ToString returns the string for the
Root Web as requested by the client.

When the browser sends out a request for http://www.url.com that is
immediately converted by a public DNS server to an IP address. It is that
public IP address that I seek to grab, not matter what Web server is hosting
our application. I have been looking for the property that contains the IP
address but can't seem to find it in the documentation.

Thanks...


"Mark Rae [MVP]" <mark@xxxxxxxxxxxxxxxxx> wrote in message
news:ecsxbj34IHA.4916@xxxxxxxxxxxxxxxxxxxxxxx
"John Kotuby" <jkotuby75@xxxxxxxxxxx> wrote in message
news:%231wSDD34IHA.2348@xxxxxxxxxxxxxxxxxxxxxxx

Not sure if this is what you want or not but, based on the subject of your
post, you can get the IP address of the host web server into a Session
variable like this:

Session["HostIP"] = Request.ServerVariables["LOCAL_ADDR"].ToString();


--
Mark Rae
ASP.NET MVP
http://www.markrae.net



.



Relevant Pages

  • Re: Redirect Public IP to Private IP behind the Pix firewall.
    ... The diagram above shows when someone from the internet request a ... Now the diagram above shows users behind the firewall when request a ... from the web server by the private IP, it works, but when the users ...
    (comp.dcom.sys.cisco)
  • Log oddity.
    ... Here's an oddity from my web server logs: ... traffic are between the firewall and the LAN IP of the web servers. ... do request a page from the webserver using the WAN IP address, ...
    (comp.security.firewalls)
  • Re: disconnect a hacker
    ... My Web server station is right next ... my attention divided by security concerns... ... see an IP connected to port 80, ... I've been forwarding my firewall logs to my ISP, ...
    (alt.computer.security)
  • Re: Firewall on server itself
    ... Perhaps the iptables could defend against an intruder who is already ... Firewall vender specific vulnerabilities ... >> be configured to protect the web server as well other computers on ... > The Gartner Group just put Neoteris in the top of its Magic Quadrant, ...
    (Security-Basics)
  • Re: [fw-wiz] Using SSL accelerators in firewalls
    ... It also depends on what you're using your SSL for, and how tightly you can couple ... your firewall with your web application. ... web server don't have to be very aware of each other. ... >> lost in the process and the security of transactions eroded. ...
    (Firewall-Wizards)