In my web application , I need to give access only to the users who are accessing my application from India. I need to block the users from accessing my application when they try to access outside India.(i.e., I willnot allow them to login and will show an error pop-up) Can anyone please tell if this is possible?
Add a Filter
which checks for requests and
String ip = request.getRemoteAddress();
Use hostip service api to check for location
For example
http://api.hostip.info/country.php?ip=74.125.236.206
This will give you country code IN
If you don't get IN
then from Filter
response.sendRedirect("someUrl");
return;
otherwise allow request
chain.doFilter(request, wrapper);
See
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With