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.
Wednesday, July 19, 2006
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.
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: http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=7228 for an implementation.
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.
To block pop-ups, use the following registry key:
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
For more information on this topic, see http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/hosting/wbcustomization.asp
To control XP SP2 security features, you can set various registry keys. For detailed information, see: http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/sp2brows.mspx