New Here?
My name is Nir and I'm the founder of Nbd-Tech, this blog is about things that interest me, so you can find posts on productivity, running a software company and obscure technological topics.
If you like what you read you can
subscribe to the blog feed or
follow me on twitter.
Here is the C# source code for the previous blog post How To Write an Automatic Update System Part 1 – the Simplest Auto Update Ever this code is for .net version 2.0 or 3.0
try
{
System.Diagnostics.Process.Start("http://www.example.com/upgrade_from_version_1.htm");
}
catch
{
// ignore exception, might be FireFox’s fault
}
Just let the system do the heavy lifting, it will automatically find the default browser for you and load the web page.
The try-catch is needed, some versions of FireFox will not handle this correctly and cause an exception (as well as an error message) – but it will still load the web page after throwing the exception.
Note that the url for this web page can never change, you never know if someone still has an old version of the software, so plan for it in advance.
How can you use Process.Start to open a web page? By default Process.Start uses Win32 API’s ShellExecute function (and not CreateProcess), ShellExecute is smart and can “execute” all sort of things including links and data files (for example, passing a doc file to Process.Start will load word it it’s installed).
posted @ Sunday, June 17, 2007 11:17 PM