How to Handle UriFormatException in standard Web browser control in .Net Compact framework
- by Sundar
I have developed a browser in my application using the standard Web Browser control. It is throwing URIFormatException and the application crashes when navigating to some sites like "WWW.oosai.com" and also on clicking back or forward buttons when there is no internet connection. I tried handling the exception but it is not working
try
{
webBrowser1.Navigate(new
Uri(address));
}
catch
(System.UriFormatException)
{
return
;
}
the stack trace is like this
bei System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
bei System.Uri..ctor(String uriString)
bei System.Windows.Forms.WebBrowser.get_Url()
bei System.Windows.Forms.WebBrowser.WnProc(WM wm, Int32 wParam, Int32 lParam)
bei System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
bei Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
bei System.Windows.Forms.Application.Run(Form fm)
bei Sts.Windows.Forms.FormRunner`1.GuiThread()
In one of other topic a guy as said this exception is handled gracefully by the web browser but in my case am not to handle and moreover my application crashes with a error message like "Aarya.exe as performed an illegal operation and please report this to the administrator"
Can anyone one help in handling the exception and is their any event to identify the availability of internet connection in web browser control