WPF WebBrowser事件的HTTP错误? [英] WPF WebBrowser events for HTTP errors?

查看:193
本文介绍了WPF WebBrowser事件的HTTP错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WPF应用程序,我正在使用WebBrowser控件来显示公共网站上的一些内容。



有时在奇怪的边缘情况下,网络连接是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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆