C#
private void OpenUrl( string url)
{
stringbrowser = GetDefaultBrowser();
if( browser.Length>0 )
{
ProcessStartInfo psi =new ProcessStartInfo();
psi.UseShellExecute = false;
psi.Arguments= url;
psi.FileName=browser;
System.Diagnostics.Process.Start(psi);
}
else
{
System.Diagnostics.Process.Start(url);
}
} 
private string GetDefaultBrowser()
{
stringbrowser =String.Empty;
RegistryKey key = null;
try
{
key =Registry.ClassesRoot.OpenSubKey(@"HTTP\shell\open\command", false);
browser =key.GetValue(null).ToString().ToLower().Replace("\"", "");
if( !browser.EndsWith(".exe") )
{
browser =browser.Substring(0, browser.LastIndexOf(".exe")+4);
}
}
catch
{
if ( key!= null )
{
key.Close();
}
}
returnbrowser;
}
VB.NET

Private Sub OpenUrl() Sub OpenUrl( ByRef url As String )
Dim browser As String=GetDefaultBrowser()
Ifbrowser.Length > 0 Then
Dimpsi AsProcessStartInfo = NewProcessStartInfo
psi.UseShellExecute = False
psi.Arguments=url
psi.FileName =browser
System.Diagnostics.Process.Start(psi)
Else
System.Diagnostics.Process.Start(url)
End If
End Sub 

Private Function GetDefaultBrowser() Function GetDefaultBrowser()
Dimbrowser AsString = String.Empty
Dim key AsRegistryKey
Try
key =Registry.ClassesRoot.OpenSubKey("HTTP\shell\open\command", False)
browser =key.GetValue(Nothing).ToString().ToLower().Replace("""", "")
If Notbrowser.EndsWith(".exe") Then
browser =browser.Substring(0, browser.LastIndexOf(".exe") + 4)
End If
Catch ex AsException
If NotkeyIs NothingThen
key.Close()
End If
End Try
GetDefaultBrowser =browser
End Function
traceBack: http://www.cnblogs.com/birdshome/archive/2005/09/11/NewBrowser.html
转载于:https://www.cnblogs.com/hdjjun/archive/2008/06/17/1223880.html