RT,RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");
            string s = key.GetValue("").ToString();
            string str = s.Substring(s.IndexOf(":") - 1, s.IndexOf(".exe") + ".exe".Length - s.IndexOf(":") + 1);
            System.Diagnostics.Process.Start(str, "www.hao123.com");如此方式是调用IE以外的默认浏览器打开好123,但是如果IE是默认浏览器的话str里面的那个值仍然是上个非IE默认浏览器的地址。所以我想问如何才能判断默认浏览器是否为IE呢?c#ie浏览器

解决方案 »

  1.   

      /// <summary>        /// 获取IE浏览器的路径        /// </summary>        /// <returns></returns>        static String IEFilePath()        {            return System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Internet Explorer\\iexplore.exe");        }
    /// <summary>        /// 获取默认浏览器的路径        /// </summary>        /// <returns></returns>        static String DefaultWebBrowserFilePath()        {            RegistryKey key = Registry.ClassesRoot.OpenSubKey("http\\shell\\open\\command", false);            String path = key.GetValue("").ToString();            if (path.Contains("\""))            {                path = path.TrimStart('"');                path = path.Substring(0, path.IndexOf('"'));            }            key.Close();            return path;        }
      

  2.   

    HKEY_CLASSES_ROOT\http\shell\open\command 
    不够准确
                HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice
    这个位置的更准确些  
      

  3.   

    ╮(╯▽╰)╭,你没有明白我的意思啊。假设360浏览器之前是默认浏览器,我通过注册表的方式获取了他的地址。之后我把IE设置成默认浏览器。但是通过注册表的方式获取的仍然是360的地址,而打开默认浏览器是IE。明白不?默认浏览器是IE的情况下,获取地址的那一招无效了。所以我想要一个有效的方法