how can i block website?
<p>Code:</p>

<pre><code>string path = @"C:\Windows\System32\drivers\etc\hosts";
StreamWriter sw = new StreamWriter(path, true);
string sitetoblock = "\r\n127.0.0.1 http://" + textBox1.Text +
    " 127.0.0.1 http://www." + textBox1.Text;

sw.Write(sitetoblock);
sw.Close();
MessageBox.Show(textBox1.Text + " blocked");
</code></pre>

<p>this is a code to block website,....but  it is not working... sometime it works.. how can i block website ?</p>

<p>tell me what is right way to block website.</p>
