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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IP recognition redirect page

Status
Not open for further replies.

3112005

Technical User
Nov 28, 2005
58
US
How can you create a link on your web page that looks at your IP address and determines if you in our outside of the network and then determines which page to redirect you to depending on your IP?
 
You could do the redirect based on a Javascript, but this is not a secure way of redirecting because the client gets to determine which of the two URLs to link with. But if you are simply doing it for administrative purposes, not security, it will work fine.

Alternatively you must use something like PHP or ASP on the server side to dynamically determine which URL to display. Of course this can also be downloaded by a determined individual, so they would have access to both URLs as well.

The only "safe" ways to accomplish the redirect that I know of is to set permissions on directory structures through the webserver, or to write a binary with obfuscated strings that is called by the web server when a specific link is clicked and have it return a URL string based on incoming IP.

Maybe someone else knows better?


pansophic
 
Turns out using asp was what we needed to do.
<CODE>
<%
Dim strRemoteIP
Dim strParsedIP
Dim strRedirectPageName

strRemoteIP = request.servervariables("REMOTE_ADDR")

'Check for access from local networks

If Left(strRemoteIp, 8) = "192.168." Then
strRedirectPageName = "
ElseIf Left(strRemoteIp, 3) = "10." Then
strRedirectPageName = "
'From the outside

Else
strRedirectPageName = "
End If

Response.Redirect(strRedirectPageName)
%>
<CODE>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top