The blog has moved to a new address. The blog is now located at


Wednesday, July 19, 2006

Why doesn’t the debugger catch exceptions in webBrowser events?

Since the core of the managed WebBrowser is an unmanaged ActiveX control, it captures all exceptions thrown in its methods before they can be passed to the debugger. This can lead to unusual behavior if you are not catching the exceptions before they leave the method. For this reason it is highly recommended that try catch blocks should be placed around the contents of all WebBrowser methods during the development and test phases, with special attention paid to procedures that could potentially throw exceptions.

Technorati : , ,

Does the WebBrowser control work in Partial Trust?

The WebBrowser control does not work in partial trust. This class makes security demands at the class level, therefore a SecurityException is thrown when a derived class or any caller in the call stack does not have full trust permission. For details about security demands, see Link Demands and Inheritance Demands.

Technorati : , , ,

WebBrowser FAQ:How do I get the site of a new window?

To get the Url that the WebBrowser is navigating to in a new window, use DWebBrowserEvents2::NewWindow3. This method is not exposed by IntelliSense. For information on how to use it, see: for an implementation.

Technorati : , ,

How do I navigate to a Url that contains escape characters?

To navigate to an addresses that contains escaped characters (such as %20) be sure to use the webBrowser.Navigate(String) method instead of the webBrowser.Navigate(Uri) method. The Uri method escapes these characters by default, while the String method does not.

Technorati : , ,

How do I block popups?

To block pop-ups, use the following registry key:
Internet Explorer
For more information on this topic, see

Technorati : , ,

Why won’t the WebBrowser navigate?

Be sure that AllowNavigation is set to true. This property not only prevents users from making the WebBrowser navigate, but also prevents the WebBrowser from programmatically being given a new Url.

WebBrowser FAQ:How can a control in the browser access the DOM of the page that is hosting it?

For an example of this, see

Technorati : , ,

WebBrowser FAQ:How do I get XP SP2 Security features?

To control XP SP2 security features, you can set various registry keys. For detailed information, see:

Technorati : , ,