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 |
|
Sergey Grischenko
Add-in Express team
Posts: 7233
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;
} |
|