Does anybody knows a way how to get the default browser without doing a lookup on the registry using the .NET framework?
A:
Why do you want to avoid registry lookup?
You can use AssocQueryString Function but internally it uses registry to get the default browser. Here is an example in C#: Getting the Default Browser Path.
Giorgi
2010-06-11 07:14:56
Good question. Until now the project was able avoiding any registry lookup and it would be nice keeping this strategy. Beside this, if there is a .NET call, this way should be prefered from my point of view.Thanks for your input, i'll test it.
Patrick
2010-06-11 07:18:46
@Giorgi: If there is a specialized API call that avoids needing to have knowledge of the registry, it makes sense to use it? Microsoft can change the internal implementation as needed.
Thorarin
2010-06-11 08:06:12
yes this is also my point of view.
Patrick
2010-06-11 08:39:20
+1
A:
Well, you could just run System.Diagnostics.Process.Start(url);
which will start the default browser and you could then check what executable the process ran, but I'm not sure if it makes much difference since Windows will be using the registry to decide which is the default.
ho1
2010-06-11 07:16:13
I also tried this, and had to wait about 20 seconds until the browser appears. So this approach isn't acceptable.
Patrick
2010-06-11 07:36:32
@Patrick: Well looking at your comment to Giorgi it seems like the reason to stay away from the registry is to keep the code neat rather than any technical reason, so I'd suggest that it would actually be best to just read it from the registry directly, anything else you do will just read it from there anyway (since that's the only place it's stored as far as I know), you'll just have more layers between your code and the registry.
ho1
2010-06-11 07:50:08