This can be done by editing a file called Hosts used by MS TCP/Ip for locating IP addresses for typed urls .What happens is Windows keeps tracks of IP address of sites visited by you in this file so it wont have to query the DNS service every time you open the website .. When you put an address in the address bar the address is first resolved to an IP address .. So Window keeps this file to list known IP addresses.
What we will do is to put a 127.0.0.1 for each site you wanna block like common ad servers and spysites .. When request to this site is found Windows will search for their entry in the Hosts file and it will found this (127.0.0.1) address and it will try to connect this site which is your Localhost address .. So it wont find the ad images and ad popups and the like .. Your computer will then give up calling the ad server and no ads will be loaded, nor will any tracking take place. Your choices for blocking sites are not just limited to blocking ad servers. You may block sites that serve advertisements, sites that serve objectionable content, or any other site that you choose to block.
This HOSTS file is located here:
Windows 95/98/Me c:\windows\
Windows XP c:\windows\system32\drivers\etc\
Windows NT/2000/ c:\winnt\system32\drivers\etc\
This Hosts file doesnt have any extension .. You may find Hosts.sam in Win 98 but it is only a dummy file … You should save the Hosts file corresponding to ur Operating System …
So a small example Hosts file :
# localhost: Needs to stay like this to work
# and so on …
The # sign denotes a comment ..