[c#] domyślna przeglądarka

0

W jaki sposób pobrać ścieżkę domyślnej przeglądarki w c# ??

Mam taką metodę:

        static private string GetDefaultBrowserPath()
        {
            string key = @"htmlfile\shell\open\command";
            RegistryKey registryKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(key, false);

            return ((string)registryKey.GetValue(null, null)).Split('"')[1];
        }

ale zwraca ona Iexplore.exe a domyślnego mam firefoxa...

0

dobra juz mam ;p

            static private string GetDefaultBrowserPath()
            {
                string key = @"htmlfile\shell\open\command";
                RegistryKey registryKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(key, false);

                return ((string)registryKey.GetValue(null, null)).Split('"')[1].Replace("\\", "\\\\");;
            }

trzeba jeszcze escape backslasha bylo zrobic :)

0

Jesli chcesz po prostu otworzyc strone dla uzytkownika to skorzystac z:
System.Diagnostics.Process.Start("http://www.onet.pl") . To otworzy stronke w domyslnej przegladarce. W innym przypadku po co Ci to?

1 użytkowników online, w tym zalogowanych: 0, gości: 1