I need to show some page in System.Windows.Controls.WebBrowser and if there is a problem with the page (server is down, page is absent, connection is broken) the control should be hidden and nice looking error message with the "report an issue" prompt should be shown instead of the ugly IE's page with error.
But I can't figure out how to detect loading error. Even if server isn't available WebBrowser raises both Navigated
and LoadCompleted
events. And even if page is successfully shown Navigated
and LoadCompleted
are raised with the null
in all there NavigationEventArgs
's properties.
Is there a way to determine when WebBrowser fail to load the page?