Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect based on IP

Status
Not open for further replies.

kraker

Technical User
Nov 28, 2000
2
US
I want to make it so I can redirect users based on their IP. For example, I want users on my network to go to one page and make everyone else go to a different page. Any help would be appreciated and if you can, an example would help a lot. Thanks.

kraker@birdnutz.com

 
I have only found this available in Netscape version 4 or greater.

If you use this:

IP = "" + java.net.InetAddress.getLocalHost().getHostAddress();

in a JavaScript function, called on load of a page you can then test the value of the variable IP and redirect to your other pages.

However, if you use ASP, you can use Request.ServerVariables("...") to get the info you want (Can't remember the name of the variable that will give you the IP) whatever the browser.

Simon
 
i believe its Request.ServerVariables("REMOTE_ADDR")

you can also use ServerVariables("REMOTE_HOST") for a hostname.
 
If you're using ColdFusion you can do the same thing.

Code:
#cgi.REMOTE_ADDR#
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top