Hi Everyone.
I'm trying to create a safe web browser for kids in C#, and I need to
disable the banner ads. Or atleast block them so that nothing happens
when they're clicked on. Please help.
Thanks.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Bryan108 reputationPosted Sep 15, 2009, 8:08 AM EDT
I didn't see the part to disable Banner Ads. Do you think you could point me in a more specific location for it? Thank you.
Kirtan PatelRank #292 · 8.6K reputationPosted Sep 15, 2009, 8:14 AM EDT
it will be Applied for Internet Explorer as well as Your Browser Control Instance also because both uses same Host File
When you Want to add Add Banner Filter to Your Web Browser Control
edit C:\Windows\System32\Drivers\etc\host
Ie if you want to Block Google
Just Write Line In That Host File using StreamWriter
127.0.0.1 google.com
That Will block Google
you can do same thing for Ad Sites also :)
dont forget to mark "Do you like answer" please if answer helped you it will give me some credits :)
Bryan108 reputationPosted Sep 15, 2009, 8:26 AM EDT
Kirtan PatelRank #292 · 8.6K reputationPosted Sep 15, 2009, 6:18 PM EDT
Here i coded That Safe Filter Take a Look It Will Allow Only Google to be Surfed No Other Site it Will Allow
dont Forget to mark "Do you like answer" please it will give me some credits :)
private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
//Here is Your White List Sites Yo can also Fill this List from Text File by lil Code
List<string> SafeList = new List<string>();
SafeList.Add("google.com");
//Check if it is From safe List if Not Block it !! :P
if (SafeList.Contains(e.Url.Host) == false)
{
webBrowser1.Stop();
MessageBox.Show("Sorry Site Blocked !!!Site is not in White List");
}
}
Bryan108 reputationPosted Sep 15, 2009, 6:29 PM EDT
Bryan108 reputationPosted Sep 16, 2009, 1:10 AM EDT