I'm facing "System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception"

-1

My desktop application has WebBrowser control which loads Website. When a network is changed and tries to write error using WebBrowser.DocumentText = "Error occurred." throws this exception.

System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception

I have a desktop application built using .NET 2.0. It's loads a website using WebBrowser control. My application works fine when there is no network issue. Means when runs the application within the office it works fine. But when the laptop brings at home and I turn it on the network switches automatically to wifi. The application tries to access the web server which has only access until connecting to the VPN. When there is no connection with web server I try to write error message using WebBrowser.DocumentText = "Error occurred." i get this exception.

// is the network up ...
if (NetworkInterface.GetIsNetworkAvailable())
{
    // checks if the IIS is connected
    connected = KioskLib.IsConnected(_HttpRoot);
    if (!connected)
    {
         _WebBrowser.DocumentText = "Error occurred.";
    }
}

This code should simply write "Error occurred." message when experiencing the IIS issue. The code works fine when restarts the application or within the office when there is no network problem.

c#
network-programming
desktop-application
asked on Stack Overflow Jun 27, 2019 by Imran Yaseen • edited Jun 27, 2019 by Imran Yaseen

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0