I will start this tutorial by telling you that it's wrong to restrict access to your visitors. Why would you want to do that?
Maybe you want to restrict spam bots - you should use captcha
in this case.
Maybe you want to restrict certain users from accessing your web site...I recommend you to alter your database and just add a simple field to store the status in (1=active, 0=inactive).
Should you ban a whole country because you target only regional traffic and they're eating your bandwith (hard to believe but...) ? Here's a solution that can be easily modified and implemented.
Whatever the reason is (and if you're here in need for such tools please use the comments form and let us know your intention and also the motif that made you search for something like this) we will try to find out various ways of restricting a (or more?!
visitor's access to your web site.
For ASP Code Click Here