Let's say that WPF WebBrowser control
shows some navigation errors and the page is not showing.
So there is an exception of WPF WebBrowser control
.
I found some similar questions here but it is not what I need.
In fact, I need some method and object that has an exception to get it somehow.
How do we can handle it?
Thank you!
P.S. There is some approach for WinForm WebBrowser Control... Can we do something similar to WPF WebBrowser
control?
public Form13()
{
InitializeComponent();
this.webBrowser1.Navigate("http://blablablabla.bla");
SHDocVw.WebBrowser axBrowser = (SHDocVw.WebBrowser)this.webBrowser1.ActiveXInstance;
axBrowser.NavigateError +=
new SHDocVw.DWebBrowserEvents2_NavigateErrorEventHandler(axBrowser_NavigateError);
}
void axBrowser_NavigateError(object pDisp, ref object URL,
ref object Frame, ref object StatusCode, ref bool Cancel)
{
if (StatusCode.ToString() == "404")
{
MessageBox.Show("Page no found");
}
}
P.S. #2 To host WinForm WebBrowser control under WPF App is not an answer I think.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…