views:

809

answers:

3

title speaks it all.

A: 

I am sure this is possible, although I could not tell you how without doing some research. However, the question that comes to my mind immediately is "why?".

Note that the default browser is something the user typically specifically chooses based on personal preference, and chancing that setting on their behalf is one sure-fire way to make your users upset. So, unless you have a very specific reason why you need to do that, the best approach is to just not do it.

Also note: the only kind of application that in my opinion has a right to even consider making this change is a browser... and then only after asking the user if that is actually what they want to happen.

jerryjvl
A: 

I think you will need to modify atleast two RegistryKeys and set the path to the alternative browser:

HKEY_CLASSES_ROOT\http\shell\open\command
HKEY_CLASSES_ROOT\htmlfile\shell\open\command

An alternative may be to create an additional entry under the Shell key and set it as the default action:

[HKEY_CLASSES_ROOT\http\shell]
(default) set to OpenWithMyBrowser

[HKEY_CLASSES_ROOT\http\shell\OpenWithMyBrowser\command]
(default) set to "MyBrowser.exe"
Cerebrus
This was very helpful thanks.
kurtnelle
+2  A: 

The default browser is saved as an entry in the registry key of windows. The values are saved on a protocol basis like this

HKEY_CLASSES_ROOT\[protocol]\shell\open\command

Where protocol can be http, https, etc. On how to access/modify registry values inside C#, you can take a look at this article

Sambatyon