Unclear exception using ClickTwice when upgrade server is down

Add-in Express™ Support Service
That's what is more important than anything else

Unclear exception using ClickTwice when upgrade server is down
 
Hernan




Posts: 37
Joined: 2011-01-28
Hi,

If I try to do an automatic upgrade with the ClickTwice solution I receive a:

----- o -----
...
...
...
Exception Type: System.ComponentModel.Win32Exception
Exception Message: Unknown error (0x800c0005)
Exception Target Site: CheckForUpdates
...
...
...
----- o -----

This happens if the server is down. I can't catch this exception in the upgrade code but we can do it in the OnError.

But I need to know when an update fails or not specifically.

What's the convenient solution for this issue?

Thanks,
Hernan
Posted 03 May, 2011 11:07:18 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
Hi Hernan,

You can use the code below to detect if the specified Url is available.

public static bool UrlExists(string url)
{
WebRequest request = null;
WebResponse response = null;

bool flag;

try
{
request = WebRequest.Create(url);
request.Method = "HEAD";
response = request.GetResponse();
flag = true;
}
catch
{
flag = false;
}
finally
{
if (response != null)
response.Close();
}

return flag;
}
Posted 04 May, 2011 13:57:52 Top