Problems with WebBrowser WPF

I am using WebBrowser in WPF as follows:

 <WebBrowser 
     Name="SSSBrowser" 
     Margin="8,4,8,8" 
     Grid.Row="1"            
     dp:WebBrowserUtility.BindableSource="{Binding WebAddress}"/>

And in C # I load it simply, for now, for example:

private string _webAddress;
public string WebAddress 
{
  get { return "http://www.somewebsite.com/updates/message/message.htm"; }
  set { _webAddress = value; }
}

What I would like to do does not allow the error to be displayed if they cannot reach the web page for any reason.

How do I know if a website returned an error in the code and turned off WebBrowser so that it does not display an error on the screen to the user?

Any help would be greatly appreciated!

+3
source share
4 answers

WPF, HttpWebRequest HttpWebResponse URL-, http StatusCode, .. 200, 404 .. , 200 . , .

+1

, ErrorOpeningURL WPF WebBrowser, , , Navigated , URI IE (res://Error.html.. IIRC) NavigationEventArgs WebResponse .

, WebBrowser, , - , , FAIL.

0
0

NavigationService System.Windows.Controls.Frame, MSDN. WebResponse WebBrowser WPF ( ).

0

Source: https://habr.com/ru/post/1765335/