I have an .Net Froms application that displays web pages through a WebBrowser control.
Is there anyway that I can detect if the control shows a ‘Page not found‘ or ‘Cannot display webpage‘ error? There doesn’t seem to be any error event handlers.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The WebBrowser windows forms control is wrapper around Internet Explorer and it doesn’t expose all the functionality of the underlying ActiveX control and particularly the NavigateError event. Here’s a workaround:
First add reference to SHDocVw.dll to your project (COM tab of Add Reference window). Then you can do the following to capture errors: