Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#.net WebBrowser不显示页面(浏览器不是最新的)_C#_Html_.net_Visual Studio 2012_.net 4.5 - Fatal编程技术网

C#.net WebBrowser不显示页面(浏览器不是最新的)

C#.net WebBrowser不显示页面(浏览器不是最新的),c#,html,.net,visual-studio-2012,.net-4.5,C#,Html,.net,Visual Studio 2012,.net 4.5,我想为我做一个迷你机器人 我运行我的WebBrowser类,它说它是IE9(WebBrowser.Version) 当我执行此命令时: wb.Navigate(www.ogame.com.us); 上面写着: "Your browser is not up to date." 但是,当我在Internet Explorer上启动页面时,它确实会显示站点。 它是嵌入VisualStudio'12和.NET framework 4.5的IE9网络浏览器吗?因为我不明白。 有什么解决办法吗 提前

我想为我做一个迷你机器人

我运行我的WebBrowser类,它说它是IE9(WebBrowser.Version)

当我执行此命令时:

wb.Navigate(www.ogame.com.us);
上面写着:

"Your browser is not up to date."
但是,当我在Internet Explorer上启动页面时,它确实会显示站点。 它是嵌入VisualStudio'12和.NET framework 4.5的IE9网络浏览器吗?
因为我不明白。 有什么解决办法吗



提前感谢。

您的应用程序需要模拟不同版本的IE。 这是通过注册表完成的

internal class Helper
{
    public static void SetBrowserEmulation(
        string programName, IE browserVersion)
    {
        if (string.IsNullOrEmpty(programName))
        {
            programName = AppDomain.CurrentDomain.FriendlyName;
            RegistryKey regKey = Registry.CurrentUser.OpenSubKey(
                "Software\\Microsoft\\Internet Explorer\\Main" + 
                "\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);
            if (regKey != null)
            {
                try
                {
                    regKey.SetValue(programName, browserVersion, 
                        RegistryValueKind.DWord);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error writing to the registry", ex);
                }
            }
            else
            {
                try
                {
                    regKey = Registry.CurrentUser.OpenSubKey("Software" + 
                        "\\Microsoft\\Internet Explorer\\Main" + 
                        "\\FeatureControl", true);
                    regKey.CreateSubKey("FEATURE_BROWSER_EMULATION");
                    regKey.SetValue(programName, browserVersion,
                        RegistryValueKind.DWord);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error accessing the registry", ex);
                }
            }
        }
    }
}

internal enum IE
{
    IE7 = 7000,
    IE8 = 8000,
    IE8StandardsMode = 8888,
    IE9 = 9000,
    IE9StandardsMode = 9999,
    IE10 = 10000,
    IE10StandardsMode = 10001
}
调用此方法

Helper.SetBrowserEmulation(AppDomain.CurrentDomain.FriendlyName, IE.IE10);

您需要重新启动程序。

是否可能是真正的url
http://www.ogame.us/
?出于好奇,URL不应该用引号引成字符串吗?您需要为您的
网络浏览器设置
功能控制
,搜索这些单词,这里已经回答了很多次了。