Re: Filtering JSP page based on client IP
Mich wrote:
Because of local content rules I have to make some website pages unavailable
for browsers in Canada. Since I am in Canada and I obviously need to view
those pages I need some code such as
if(IP==canada) {
if(IP!=my IP) {
This page is not available in Canada
}
}
I did a Google search on this and everything I found was about filtering the
complete website; and I would really like to be able to do this for
individual pages.
It is called geofiltering/geolocalisation.
You need some simple code and an IP-to-country
database.
There are a couple of free such databases available and
some commercial solutions.
You should be aware that:
1) those databases are not 100% correct more like 95-99%
2) they need to be constantly updated
3) they can not catch people using a proxy server
in another country than where they are sitting
I have a Java program to load data and a demo
of how to test in a JSP page.
Drop me an email if you want a copy of the code.
Arne