private void webpage_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
  {
    SqlCommand cmd = new SqlCommand("SELECT * FROM [blacklist] WHERE BlackListed_Sites = '"+    webpages + "'", cs);
            cs.Open();
            cmd.Connection = cs;
            SqlDataReader reader = null;

            reader = cmd.ExecuteReader();
            if (reader.Read())
            {

                CheckState.Checked.ToString();
                MessageBox.Show("Blocked");

            }

            else
            {


                string url = ComboAddress.Text;
                if (url == "")
                    return;


                WebBrowser thispage = GetCurrentWebBrowser();
                thispage.Navigate(url);
                timer1.Enabled = true;
                lblpageinfo.Text = thispage.StatusText.ToString();

                ComboAddress.Items.Add(url);

            }


            cs.Close();


            UpdateAllNames();
            UpdateBackForwardButtons();
            timer1.Enabled = false;

            pictureBox_busy.Image = Smart_Browser.Properties.Resources._4;


        }

this code for blocking the site. It works only when i type any website on the combo address but when i type site name in google search engine or any other search engine the site is to be shown. so i want site should be block and not open even if the site name written in any search engine as well as combo address.

Avoiding to open Google cached pages is not possible. They're going over IP's to a mixture or cached data and the actual page.

If you want to have something really effective, try Microsoft Forefront Threat Management (http://www.microsoft.com/germany/forefront/default.mspx) and don't try to write block-code yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.