determine IP of hosting web-server

  • Thread starter Thread starter John A Grandy
  • Start date Start date
J

John A Grandy

programmatically, how to determine the IP of the web-server running the
web-app's code ?
 
Hello John A Grandy" johnagrandy-at-yahoo-dot-com,

I imagine you're probably looking for

Request.ServerVariables["LOCAL_ADDR"] or Request.ServerVariables["SERVER_NAME"]
 
Matt Berther said:
Hello John A Grandy" johnagrandy-at-yahoo-dot-com,

I imagine you're probably looking for
Request.ServerVariables["LOCAL_ADDR"] or
Request.ServerVariables["SERVER_NAME"]

It may not matter to your code, but keep in mind that a computer may have
multiple IP addresses, and that they can even change from time to time.

An IP address is a "Network layer" entity, and your web application is up
above the "Application layer" in the 7-layer model. That may not mean much,
but it's probably a hint that you should ask yourself whether you really
need to be reaching down from layer 8 to layer 3 to grab an IP address.
Maybe there's a better way to accomplish your goal.

John Saunders
 
in this particular case, i think i'm alright. it's just a single web server
on a single windows 2003 server with a static ip. there is also an
identical development / test platform.



John Saunders said:
Matt Berther said:
Hello John A Grandy" johnagrandy-at-yahoo-dot-com,

I imagine you're probably looking for
Request.ServerVariables["LOCAL_ADDR"] or
Request.ServerVariables["SERVER_NAME"]

It may not matter to your code, but keep in mind that a computer may have
multiple IP addresses, and that they can even change from time to time.

An IP address is a "Network layer" entity, and your web application is up
above the "Application layer" in the 7-layer model. That may not mean much,
but it's probably a hint that you should ask yourself whether you really
need to be reaching down from layer 8 to layer 3 to grab an IP address.
Maybe there's a better way to accomplish your goal.

John Saunders
 
Back
Top