Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
if the user open this site >>>"www.google.com"

block the site and show form1 or messagebox .... `in vb.net or c#`

thanks for all ,,, i wait you
Posted
Updated 6-Dec-12 20:16pm
v2

1 solution

try it..
C#
private void button1_Click(object sender, EventArgs e)
        {
            String path = @"C:\Windows\System32\drivers\etc\hosts";
            StreamWriter sw = new StreamWriter(path, true);
            String sitetoblock = "\n 127.0.0.1 Your_url_for_blocking";
            sw.Write(sitetoblock);
            sw.Close();
            MessageBox.Show("Blocked!!");
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900