J
James CC
Hi there,
I'm trying to open a web page in a browser. I wanted to open the default
browser on the computer, rather than limiting it to IE, so I did the
following (web page has been changed to protect the innocent! ;oD)
// botch - this gives an error if blocked by zonealarm or other firewall
try
{
System.Diagnostics.Process.Start("http://www.google.com/");
}
catch (Exception ex)
{
MessageBox.Show("Error while opening browser window. Check your firewall
permissions.\nError returned was : " + ex.Message);
}
As the comment shows, if the .NET application's access to the internet is
blocked by ZoneAlarm (or a similar 'outward bound blocking' firewall) then
the Start() fails - but it does not return an error or exception, or indeed
return at all. Stepping through in the debugger shows that the Start() never
returns and the next line is not executed.
Strangely, the UI keeps working, kind of; if you then do the above a second
time then it gives an exception of 'The system cannot find the file
specified'.
Of course it works fine if the firewall allows access, but that's not much
comfort.
Does anyone have a solution? Failing that, can someone suggest another way
to open a web page in the default browser that does not have the above
problem. Failing that, can someone suggest the best way to open a web page
in IE without the above problem?
Thanks tons - this one's driving me crazy...
James CC
I'm trying to open a web page in a browser. I wanted to open the default
browser on the computer, rather than limiting it to IE, so I did the
following (web page has been changed to protect the innocent! ;oD)
// botch - this gives an error if blocked by zonealarm or other firewall
try
{
System.Diagnostics.Process.Start("http://www.google.com/");
}
catch (Exception ex)
{
MessageBox.Show("Error while opening browser window. Check your firewall
permissions.\nError returned was : " + ex.Message);
}
As the comment shows, if the .NET application's access to the internet is
blocked by ZoneAlarm (or a similar 'outward bound blocking' firewall) then
the Start() fails - but it does not return an error or exception, or indeed
return at all. Stepping through in the debugger shows that the Start() never
returns and the next line is not executed.
Strangely, the UI keeps working, kind of; if you then do the above a second
time then it gives an exception of 'The system cannot find the file
specified'.
Of course it works fine if the firewall allows access, but that's not much
comfort.
Does anyone have a solution? Failing that, can someone suggest another way
to open a web page in the default browser that does not have the above
problem. Failing that, can someone suggest the best way to open a web page
in IE without the above problem?
Thanks tons - this one's driving me crazy...
James CC