Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8109939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:34:45+00:00 2026-06-06T01:34:45+00:00

I have a simple web browser embedded in an application that allows a user

  • 0

I have a simple web browser embedded in an application that allows a user to search Wikipedia, and I’m trying to prevent the user from browsing to other websites outside wikipedia (e.g. by clicking an external link the references). Right now, I’m using this simple code:

this.textBoxAddress.Text = this.webBrowser.Url.ToString();
if (this.webBrowser.Url.Host != "en.wikipedia.org")
{
    this.webBrowser.Visible = false;
    this.labelErrorMessage.Visible = true;
}
else
{
    this.webBrowser.Visible = true;
    this.labelErrorMessage.Visible = false;
}

This code works, except the page is already loaded when it’s run. If I put this code into the _Navigating event to try to preemptively stop the user before the page is loaded, it fails because the web browser control doesn’t update the Url property until after the page is loaded.

The reason I don’t like this code is because the page has already loaded when it’s called, so any errors in that page (e.g. script errors, which display a popup) show, even though the web page does not.

I’ve read sources that say not to use the WebBrowser control, for various reasons, but in this case, security isn’t a major issue. I also don’t need to worry about the end-user doing something, since this application is an in-house application that has literally only one user, and he won’t bypass the security.

Disabling all other pages in IE’s settings is not a solution either, because this user utilises IE for other surfing, and the intranet sites of this organisation run on IE as well (and those addresses change, so simply allowing all of them would be difficult to anticipate).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:34:47+00:00Added an answer on June 6, 2026 at 1:34 am

    Subscribe to the WebBrowser.Navigating event. Check the WebBrowserNavigatingEventArgs.Url property and set WebBrowserNavigatingEventArgs.Cancel=true if it’s not wikipedia.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Web Browser Control that displays a local webpage and that
Does anyone have code of a simple web browser file/script (HTML/javascript/whatever) that can upload
I have a Windows app that houses a web browser (Internet explorer) embedded in
I have a simple Java web application using HSQLDB embedded database. The application is
I have a simple silverlight application and i need to add the web browser
I have a .NET Winforms web browser control that is rendering some application information,
Say I want to have a simple web app that takes some user input,
I have a simple web application which lets the user upload local user data
I have created a simple web browser using c# and I want to block
I have a simple web service that uses an oracle database. When I test

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.