I am using
System.Windows.Forms.WebBrowser
control in C# for displaying some pages. I want to do some custom work when the user clicks on a url of a page which does not exist.
Basically I want to set some values when the browser displays the following message
The page cannot be displayed
The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties
How can I get the status so that I can differenciate between a page loaded and error page?
If you cast WebBrowser to the underlying ActiveX implementation, you can access the NavigateError event.
Note: You’ll need to add a reference to SHDocVw. Confusingly, this is in the COM tab with the name “Microsoft Internet Controls” with a path of c:\windows\system32\ieframe.dll