Prevent Clicking your AdSense by Accident in ASP.NET

13. February 2009

Here is a simple ASP.NET Code Snippet that Hides your AdSense by blocking or filtering your IP.

This part you would want to place before what you want to block the IP from:

<%

string strIP = Request.UserHostAddress;

switch (strIP) {

case "IP#1 here":

Response.Write("No Ad1: " + strIP + " ");

break;

case "IP#2 here":

Response.Write("No Ad2: " + strIP + " ");

break;
default:

%>

The following you place after whatever it is you want blocked from certain IPs:

Some Code here

<%

break;

}

%> 

Tags:

Reference , ,

Comments

Comments are closed