Re: How can I get the IP address of the host Web Server into a Ses
- From: bruce barker <brucebarker@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 11 Jul 2008 11:46:15 -0700
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
- References:
- How can I get the IP address of the host Web Server into a Session variable?
- From: John Kotuby
- Re: How can I get the IP address of the host Web Server into a Session variable?
- From: Mark Rae [MVP]
- Re: How can I get the IP address of the host Web Server into a Session variable?
- From: John Kotuby
- How can I get the IP address of the host Web Server into a Session variable?
- Prev by Date: Re: How can I get the IP address of the host Web Server into a Session variable?
- Next by Date: Re: Problem getting web application project support with VS 2005
- Previous by thread: Re: How can I get the IP address of the host Web Server into a Session variable?
- Next by thread: Re: How can I get the IP address of the host Web Server into a Session variable?
- Index(es):
Relevant Pages
|