I'm attempting to block websites in windows form application C# using the WebBrowser Tool for a child browser project. So currently I'm able to block the predefined websites, however, I want to be able to add to the array which isn't possible. So I was wondering if there was another way?
private void webBrowser1_Navigating(object sender,WebBrowserNavigatingEventArgs e)
{
String[] BlockList = new String[5]; //Array list stores the block list
BlockList[0] = "http://www.google.com";
BlockList[1] = "http://www.google.co.uk";
BlockList[2] = "http://www.gmail.com";
BlockList[3] = "http://www.yahoo.com";
BlockList[4] = "http://www.bing.com";
for (int i = 0; i < BlockList.Length; i++)
{
if (e.Url.Equals(BlockList[i]))
{
e.Cancel = true;
MessageBox.Show("Booyaa Says No!", "NO NO NO", MessageBoxButtons.OK, MessageBoxIcon.Hand); // Block List Error Message
}
}
}