WPF WebBrowser事件的HTTP错误? [英] WPF WebBrowser events for HTTP errors?
问题描述
有时在奇怪的边缘情况下,网络连接是flakey,网络浏览器将显示该程序无法显示网页错误页面。有没有办法听WebBrowser来检测何时发生,所以我可以加载占位符?
你可以尝试使用 NavigationService
从 System.Windows.Controls.Frame
,如 MSDN论坛帖子。 WPF中的 WebResponse
对于 WebBrowser
控件将始终为空, >)。
I have a WPF application and I'm using the WebBrowser control to display some content from a public website.
Sometimes in weird edge cases when the network connectivity is flakey, the web browser will show the "This program cannot display the webpage" error page. Is there some way to listen to the WebBrowser to detect when this occurs, so I can load a placeholder?
You could try using the NavigationService
from System.Windows.Controls.Frame
as indicated in this MSDN forum post. The WebResponse
will always be null for the WebBrowser
control in WPF (as described in the post).
这篇关于WPF WebBrowser事件的HTTP错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!